Updating Lokalise iOS SDK from 0.5 to 0.6

Updated a month ago ​by Fedya

Lokalise SDK received an update that makes interaction with it more responsive. But in order to make it so, some breaking changes were introduced. This article will guide you trough what was added, changed and removed.


Modulemap

Lokalise SDK now includes Modulemap. This means if you are a Swift user you no longer need to include #import <Lokalise/Lokalise.h> line into your Bridging-Header file. And if that the only line you had in there, you don't need it all now. 


New constant and property

LokaliseFrameworkVersion gives you details version of Lokalise SDK if you need it.

Lokalise.shared.lokaliseBundleVersion property provides you with bundle version currently used by Lokalise SDK.


Delegate

LokaliseDelegate was removed in favour of more responsive methods introduced with this update.


Check for updates

checkForUpdates method received an upgrade and will give you more details in one place.  No longer you need to monitor LokaliseDelegate events to get update feedback.

// Old
Lokalise.share.checkForUpdates()
func lokaliseDidCheck(forUpdates localise: Lokalise) {}
func lokaliseDidUpdate(_ lokalise: Lokalise) {}
func lokalise(_ lokalise: Lokalise, didFailToUpdateLocalizationWithError error: Error) {}
// New
Lokalise.share.checkForUpdates { (updated: Bool, error; Error?) in
    // All necessary information in one place 
}


Localization Locale

Lokalise.shared.localizationLocale is now a readonly property. You can set it using new method.

Lokalise.shared.setLocalizationLocale(
    locale,
    makeDefault: false,
    completion: { (error: Error?) in
        // Error is nil if error is locale was set
    }
)




How did we do