New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MMWormholeSession and WatchConnectivity Support #50

Merged
merged 15 commits into from Sep 15, 2015

Conversation

Projects
None yet
4 participants
@cnstoll
Contributor

cnstoll commented Jun 10, 2015

This PR includes a new subclass of MMWormhole called MMWormholeSession that is intended to help make things easier for existing users of MMWormhole to migrate their Apple Watch apps to watchOS 2 and the WatchConnectivity framework.

http://conradstoll.com/blog/2015/6/10/mmwormhole-and-watchconnectivity-on-watchos-2

@@ -0,0 +1,137 @@
//
// MMWormholeSession.m

This comment has been minimized.

@lukelabonte

lukelabonte Jun 10, 2015

This class is not added into the Xcode projects.

This comment has been minimized.

@cnstoll

cnstoll Jun 10, 2015

Contributor

I added a separate branch with all the project changes called watchOS_example. I wanted to keep this PR a little cleaner for now to focus on the core changes.

@lukelabonte

This comment has been minimized.

lukelabonte commented Jun 10, 2015

We may want to think about having 3 pod subspecs. 1 for Core which would be just MMWormhole.h/.m. One for the initial implementation of wormhole, and one for the new watchOS 2 implementation.

Then the developer can pick 1 or the other (even both), or just the core and roll their own. I am thinking something like what AFNetworking podspec does. Thoughts?

@cnstoll

This comment has been minimized.

Contributor

cnstoll commented Jun 10, 2015

Agree, I think a separate pod spec definitely makes sense.

#import "MMWormhole.h"
@interface MMWormholeSession : MMWormhole

This comment has been minimized.

@larsacus

larsacus Jun 10, 2015

Should probably use NS_CLASS_AVAILABLE_IOS(9_0) here since this class exclusively uses iOS 9 bits.

// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

This comment has been minimized.

@larsacus

larsacus Jun 10, 2015

Does this class need NS_ASSUME_NONNULL_BEGIN, or was that intentionally left out?

This comment has been minimized.

@cnstoll

cnstoll Jun 17, 2015

Contributor

It's not clear to me if that is actually needed in the implementation or not.

@cnstoll

This comment has been minimized.

Contributor

cnstoll commented Jun 17, 2015

As I explained in a comment in the MMWormholeSession header, I just updated MMWormholeSession to be a singleton. The reasoning here is that WCSession is also a singleton, and therefore only has one delegate that can receive message callbacks.

I don't intend for this to be the final solution for the shipping version of MMWormholeSession, but at least for now this will prevent the issues that would otherwise occur from initializing multiple wormhole sessions and wondering why only one of them receives messages from its listeners.

If you have ideas for how we can work around the fact that WCSession is a singleton and therefore only has one delegate, please weigh in here :)

@cnstoll

This comment has been minimized.

Contributor

cnstoll commented Jun 17, 2015

There is also a radar that has been filed regarding WCSession being a singleton. Feel free to dupe or file your own radar if you have thoughts about that which you want to share with Apple.

rdar://21364679

@pzearfoss

This comment has been minimized.

pzearfoss commented Jun 17, 2015

I'll have a look at your radar and probably dupe it. Singletons tend to be a code smell as it is.

@cnstoll cnstoll added this to the 1.3.0 milestone Sep 14, 2015

cnstoll added a commit that referenced this pull request Sep 15, 2015

Merge pull request #50 from mutualmobile/watchOS
MMWormholeSession and WatchConnectivity Support

@cnstoll cnstoll merged commit 96a37d9 into master Sep 15, 2015

@cnstoll cnstoll deleted the watchOS branch Sep 15, 2015

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