Author: admin

How to detect iPhone X through code

I was just playing around with the iPhone X simulator in Xcode, and I realized one of my apps has a view bug. I have a button placed with code (at the bottom of the screen in the middle) that is overlapping the bar that you swipe up to get to the home screen. Is there a way to detect, through code, if the device is an iPhone X, and an iPhone X only, so I can write code to counteract the bug? Maybe... »

Override question?

I am trying to create an app similar to the Guided Project: List in “App Development with Swift” with one change.  I would like an opening view controller that segues to the tableview.  I have that set up but when I get to the point in the lesson where it overrides the function viewDidLoad I get an “override can only be specified on class members” error.  That override is a... »

Can only pass data between 2 of 3 View Controllers

Hi,   I´m making a simple orderplacement app. This app uses 3 View Controllers: Menu1, Menu2 and Checkout. (Menu2 was recently added, and is the source of the problem) I pass data between Menu VC an Checkout with a Swift file called orderModel. This has been working perfectly for a long time now, but when I added a new VC, Menu2, I got problems. Menu2 won´t pass data to Checkout VC. I have done th... »

Differentiate between Homescreen click and Lock Screen click

Hey guys,   I have a bluetooth app that connects to a device. What I want to achieve is this: when a user switches apps or goes to the homescreen, I want to disconnect from the bluetooth device but when a user hits the lock screen, I want the bluetooth connection to be maintained.   I am not super familiar with swift and ios dev so any advice would be great.   Is there a way to determine whether a... »

Swift framework wrapping a static library

I now spent 2 days trying to create a Swift framework that includes a static (Objective-C) library, so I guess it is time to ask for help here… My problem: I have a static library created with Objective-C and we need to release a framework that can be used by our customers to use the static library. Creating an Objective-C framework that wraps around the static library is no problem, but as ... »

exclamation point after try – try!

What does it mean when I see an exclamation point after the “try” statement like the following code?  Is it unwrapping the result of the statement?                               do {                                 try! cnContactStore.execute(saveRequest)                             } catch let error as NSError {                                                                print(erro... »

NSFileManager copyItemAtURL:toURL:error: fails to give error when dstURL exists on 10.12.4

So, for a simple copy operation in my app, I use the follow NSFileManager method:   copyItemAtURL:toURL:error:   Since I retrieve the url from the pasteboard, there is a chance that the source URL is already at the destination directory in my app (that is, user copies the file in another app maybe, then does paste in my app, so srcURL and dstURL is the same). In that case, I didn’t really ca... »

How to zoom to a specific point in PDFKit (Double tap)

I am using PDFKit in an IOS 11 app and would like to support zooming in to a specific section of the PDF when the user double-taps on the PDFView.  From what I can see in the PDFKit documentation only simple zoom in/out is supported without the ability to specify a point or region that you want to zoom into.    Does anyone know how I can implement this feature?   Thanks. Powered by WPeMatico »

NSCollectionViewItem + Storyboard + ItemPrototype

I tried to connect the outlet ItemPrototype from the NSCollectionView to the  NSCollectionViewItem but it was not possible.    I would not like to use a different .xib for the NSCollectionViewItem.    Is it possible to do the outlet using just an storyboard? Powered by WPeMatico »

Exception in IKImageBrowserView in macOS 10.13 GM

I’ve got a fairly simply application, with IKImageBrowserView embedded in NSScrollView, as is the most common case. When running on macOS 10.13 High Sierra GM and whenever the IKImageBrowserView is presented and there are enough items in it to make it scrollable, it throws and exception with the following stack trace:   NSInvalidArgumentException *** -[NSProxy doesNotRecognizeSelector:lastIn... »

Skip to toolbar