Tuesday, December 23, 2014

Using reserved word in Swift methods

If you attempt to call a method that uses a Swift reserved word in its method name, you will get an error. For example, the NSURLProtectionSpace class has an initializer that takes in an argument with the protocol label:

 var protectionSpace = NSURLProtectionSpace(
            host: url,
            port: 80,
            protocol: "http",
            realm: nil,

            authenticationMethod: nil)

As the protocol is a Swift reserved word, this will cause a problem for the compiler. To fix this, enclose the protocol word with a pair of back-quotes (``), like this:

 var protectionSpace = NSURLProtectionSpace(
            host: url,
            port: 80,
            `protocol`"http",
            realm: nil,

            authenticationMethod: nil)

Sunday, December 21, 2014

New Course - IOS304 – 2-Day Advanced iOS 8 Programming

In this two-day course, you will learn the new APIs available in iOS 8. iOS 8 includes a sleuth of new APIs to make apps development easier and more powerful. In this course, you will focus on four key areas – app extension programming, Touch ID authentication, server-side database development using CloudKit, and using the Handoff APIs to synchronize the user activities on multiple devices.

Topics
• Programming App Extensions o Creating Today extensions (widgets)
     o Sharing content with other apps
     o Creating Actions o Document Providers
• Touch ID Programming
     o Enabling Touch ID authentication in your application
• Using CloudKit
     o Creating databases in iCloud using the CloudKit Dashboard
     o Accessing databases from iCloud
• Using the Handoff API
    o Syncing user activities between Mac OS X and iOS

Course Fee
S$1,297 (nett; no GST)

Date
16-17 Feb 2015

Venue
Bayview Hotel
Singapore

Tuesday, December 16, 2014

Foundation of iPhone Programming course on 29-30 Dec 2014 is confirmed!

The Foundation of iPhone Programming course on the 29-30 Dec 2014 is confirmed! You will also get a crash course in Swift, plus two very useful and nicely laminated Swift cheat sheets! 

Download your own Swift Cheat Sheets:
http://weimenglee.blogspot.sg/2014/11/swift-cheat-sheets-download-today.html

Course Calendar
http://weimenglee.blogspot.sg/p/blog-page.html
Venue
Bayview Hotel
Singapore

Course Fee
S$1,097 (nett; no GST)

Tuesday, December 02, 2014

Article - Using Objective-C and Swift together in iOS Apps

As an addendum to my previous article about the role of Swift in iOS app development, we now take a look at how Swift and Objective-C can be used together in iOS apps. Despite Apple’s intention to replace the Objective-C language using Swift, it is not practical in the short term simply due to the fact that developers are deeply entrenched in Objective-C. Rather than force Swift down the developer’s throat, Apple has made it easy to allow Objective-C to interoperate with Swift. In this article, I run through a couple of simple examples to illustrate first how you can use Swift within an Objective-C project, and then how to include Objective-C within a Swift project.

Read the article here.

iOS courses are all updated to use Swift

My iOS courses are all fully updated to use Swift. When you attend the Foundation of iPhone Programming course, you will also get two nicely laminated Swift Cheat Sheets.  Use these cheat sheets to help you migrate your existing code to Swift. If you are a beginning iOS developer, these cheat sheets will save you lots of time.

Want your own cheat sheets? Download them here.