Updating to Swift 4.1

Swift 4.1 is released on the 29th of March and will be shipped with Xcode 9.3. Although it’s a minor language release, it did bring some improvements. How to get started? First of all, Swift 4.1 is source compatible with Swift 4.0. So no need to rush! Before you start, get yourself up to date … 

 

Optional protocol methods in Swift

In Swift it’s kind of unsupported to implemented optional protocol methods. You can, which is ugly, use the @objc syntax: @objc protocol MyProtocol { optional func doSomething(); } class MyClass : MyProtocol { // no error } Another disadvantage here is that structs are unsupported, as you’re bridging for Objc. Using protocol extensions to create … 

 

Launch time performance optimization

Time for a small post about launch time performance optimization. I did some research in improving the launch time of my current app. I started creating a main.swift file, removed @UIApplicationMain from my AppDelegate and added this line to my main.swift: let StartTime = CFAbsoluteTimeGetCurrent() Resulting in this complete file: // // main.swift // // … 

 

Moya with SwiftyJSON using Moya-SwiftyJSONMapper

I’ve just released Moya-SwiftyJSONMapper which makes it really easy to map MoyaResponse to a struct or model inheriting from the ALSwiftyJSONAble protocol in combination with SwiftyJSON. Model creation with SwiftyJSON After you’ve created your model: import Foundation import Moya_SwiftyJSONMapper import SwiftyJSON final class GetResponse : ALSwiftyJSONAble { let url:NSURL? let origin:String let args:[String: String]? required … 

 
Follow on Feedly