swift3ios10watchos-3sqlite.swift

Can I sync a SQLite.swift database to WatchOS?


I have an application that uses SQLite.swift to save a list of shopping items. It works quite well, and is deeply rooted in the app. But I've been getting asked to make a WatchOS app that has the same items on your wrist.

My issue with this, is that all the ways of syncing the data between two devices is through NSUserDefaults. But doing that would mean uprooting my entire way of saving data, so is there a way to sync my SQL database onto WatchOS by using SQLite.swift?


Solution

  • Yes of course: sync the database (or the shared part of it) yourself.

    Read the "Communicating with the Counterpart App" chapter of https://developer.apple.com/reference/watchconnectivity/wcsession and choose the best way to transfer your information.