iOS 11 is the biggest developer platform update since Swift was introduced. ARKit, Core ML, Drag and Drop on iPad, the new Files app, and a thoroughly modernised Swift 4 language all land at once. Developers have a lot to absorb — this post distils the essentials.
ARKit: Augmented Reality for Every iPhone 6S and Newer
ARKit uses the iPhone’s camera, gyroscope, and accelerometer to map real-world surfaces and place virtual objects on them — no external sensors required. A basic AR session takes minutes to set up:
import ARKit
class ViewController: UIViewController, ARSCNViewDelegate {
@IBOutlet var sceneView: ARSCNView!
override func viewWillAppear(_ animated: Bool) {
let config = ARWorldTrackingConfiguration()
config.planeDetection = .horizontal
sceneView.session.run(config)
}
}
IKEA Place, Pokémon GO updates, and dozens of retail apps launched ARKit features within weeks of iOS 11’s release — signalling how production-ready it was on day one.
Core ML: On-Device Machine Learning
Core ML lets you run pre-trained machine-learning models directly on the device — no server round-trip, no internet connection required. Convert any TensorFlow, Keras, or scikit-learn model to the .mlmodel format with coremltools, drag it into Xcode, and get a generated Swift class with a few lines of inference code.
Swift 4: Codable — Bye-Bye Manual JSON Parsing
Swift 4’s most beloved addition is the Codable protocol (a typealias for Encodable & Decodable). Define a struct that matches your JSON and let the compiler generate all the parsing code:
struct User: Codable {
let id: Int
let name: String
let email: String
}
let json = Data("""{ "id": 1, "name": "Alice", "email": "alice@example.com" }""".utf8)
let user = try JSONDecoder().decode(User.self, from: json)
print(user.name) // Alice
Drag and Drop (iPad)
iOS 11 brings system-wide Drag and Drop to iPad. Apps adopt it via the UIDragInteraction and UIDropInteraction APIs. TableView and CollectionView have built-in drag-and-drop support.
String Improvements in Swift 4
Strings are back to being a Collection of Character values, multi-line string literals use triple quotes """, and substring handling no longer requires a String() initialiser at every turn.
iOS 11 is a landmark release. ARKit and Core ML alone open entirely new categories of apps. Start experimenting with both now — users will reward the creativity.