I work on Diple, a Markdown writing app with a local document library. This article looks at one part of its implementation: moving that library between devices.
The transfer needs to preserve more than text files. Documents can have local images, notes and version history. Folders and Collections also carry relationships that need to survive the move.
Here are the protocol and import decisions in the current design, including the limits of its duplicate handling.
Separate the connection from the transfer
The existing transport uses Multipeer Connectivity. Both devices advertise and browse for the same service, and the user selects a peer and confirms the connection.
The session is configured to require encryption:
let session = MCSession ( peer : peerID , securityIdentity : nil , encryptionPreference : . required )
Enter fullscreen mode
Exit fullscreen mode
That configuration does not replace peer selection or user consent.…