Skip to content

Conversation

@stemberamichal
Copy link
Contributor

No description provided.

@stemberamichal
Copy link
Contributor Author

stemberamichal commented Oct 11, 2018

I would like to discuss here scheme of the communication through WatchConnectivity between iOS and watchOS apps :)

What I consider now is following approach (with future plans to enable editing Todos in watchOS):

Create DictionaryEncoder/DictionaryDecoder

This is necessary because this is universal form for both background transfer (application context) and messaging.

This means sending and receiving message data won't be used at all.

Define contexts which will be sent over - WatchContext, IOSContext

  • WatchContext will be used for one-way communication from iOS to watchOS app. It will contain current items, identifier of version (unique) and date of the snapshot creation.
  • IOSContent will be used for communication the other way (from watchOS to iOS). It will contain identifier of version and date of snapshot. Items are not necessary as the app will be consumer only for now.

Prepare storage for those contexts (NSUserDefaults)

iOS and watchOS parts will both have both contexts cached locally to be able to determine what the other part has currently available. Based on that information iOS app will coordinate intervals to refresh the data.

Wrap WCSessionDelegate

It might be useful to create separate session delegate which would notify its own delegate using WatchContext and IOSContext. It would be responsible for parsing and switching between messages and application context type of communication.

Create manager on the side of iOS and watchOS

On each of both sides will be manager which controls the flow of communication and plans the communication ahead (refreshes the data based on time interaval)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant