iOS Designated Initializers : Using NS_DESIGNATED_INITIALIZER

The use of NS_DESIGNATED_INITIALIZER is nicely explained in http://useyourloaf.com/blog/2014/08/19/xcode-6-objective-c-modernization.html: The designated initializer guarantees the object is fully initialised by sending an initialization message to the superclass. The implementation detail becomes important to a user of the class when they subclass it. The rules for designated initializers in detail: A designated initializer must call (via super) … Read more

How can I programmatically find Swift’s version?

You can use conditional compilation directives to test for the specific Swift version used to build your project: #if swift(>=5.0) print(“Hello, Swift 5!”) #elseif swift(>=4.0) print(“Hello, Swift 4!”) #elseif swift(>=3.0) print(“Hello, Swift 3!”) #elseif swift(>=2.2) print(“Hello, Swift 2.2!”) #elseif swift(>=2.1) print(“Hello, Swift 2.1!”) #endif

Xcode 6 with Swift super slow typing and autocompletion

Quit Xcode and restart the Mac are not required but preferred. Delete the content of the folder ~/Library/Developer/Xcode/DerivedData Delete the content ~/Library/Caches/com.apple.dt.Xcode This is a temporally solution, but works greatly. Below the script using Script Editor app. tell application “Terminal” do script “rm -frd ~/Library/Developer/Xcode/DerivedData/*” do script “rm -frd ~/Library/Caches/com.apple.dt.Xcode/*” end tell Alternatively, you can … Read more

How to use openURL for making a phone call in Swift?

I am pretty sure you want: UIApplication.sharedApplication().openURL(NSURL(string: “tel://9809088798”)!) (note that in your question text, you put tel//:, not tel://). NSURL’s string init expects a well-formed URL. It will not turn a bunch of numbers into a telephone number. You sometimes see phone-number detection in UIWebView, but that’s being done at a higher level than NSURL. … Read more

tech