We’ve received an email or two asking how to use Zumero sync from Swift code. If you’ve used other Objective-C frameworks in your Swift projects, the steps are just what you’d expect. If you haven’t, don’t worry - it’s not that bad.
Create a Swift-based project, as usual.
$ cat >> Podfile pod 'ZumeroSync' $ pod install Analyzing dependencies Downloading dependencies Installing ZumeroSync (184.108.40.20689) Installing sqlite3 (220.127.116.11) Generating Pods project Integrating client project [!] Please close any current Xcode sessions and use `swiftnzum.xcworkspace` for this project from now on.
We’ll now open the workspace as instructed, and it looks like we’re all set:
Except that Swift has no idea what we’re talking about:
Add a new Objective-C file. Call it what you like:
Yes, we do want to create a bridging header:
ZumeroSync import to that header:
1 2 3 4 5
We can delete the “dummy” Objective-C file (optional, but it serves no purpose here):
And voilà, Swift has heard of Zumero:
As for the actual usage, it’s just a Swift-y version of the Objective-C call:
1 2 3 4 5 6