๐Ÿ“ฆ calda / WatchKit-for-iOS

:watch: An experimental framework for running Apple Watch apps on iOS. Finalist at HackGT 2016 in Atlanta, GA.

โ˜… 9 stars โ‘‚ 0 forks ๐Ÿ‘ 9 watching
๐Ÿ“ฅ Clone https://github.com/calda/WatchKit-for-iOS.git
HTTPS git clone https://github.com/calda/WatchKit-for-iOS.git
SSH git clone git@github.com:calda/WatchKit-for-iOS.git
CLI gh repo clone calda/WatchKit-for-iOS
Cal Stephens Cal Stephens Update README eafdef9 8 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ Demo App
๐Ÿ“ Demo App.xcodeproj
๐Ÿ“ images
๐Ÿ“ WatchKit for iOS
๐Ÿ“„ .gitignore
๐Ÿ“„ README.md
๐Ÿ“„ README.md

WatchKit for iOS

WatchKit for iOS is a UIKit-based reimplementation of the WatchKit framework. It lets you run Apple Watch apps on iOS. This project was a finalist at HackGT 2016 in Atlanta, GA.

Demo

Emoji Sudoku is a WatchKit app I made back in 2015. WatchKit for iOS is capable of running the app's original source code with almost no modifications. The current App Store version of Emoji Sudoku uses this framework.

Usage

Carthage

You can add WatchKit for iOS to your Xcode project by using Carthage. Just add github "calda/WatchKit-for-iOS" to your cartfile.

WatchKit source code

Replace instances of import WatchKit to import WatchKit_iOS. You shouldn't have to make any other changes.

iOS

On iOS, using WatchKit for iOS is as simple as importing WatchKit_iOS and spinning up a new WatchContainerViewController:

let watchViewController = WatchContainerViewController.create(
    withInterfaceFileNamed: "Watch Interface", // the name of the .xml file that matches the WatchKit .storyboard
    inNamespace: "Emoji Sudoku") // the name of the iOS app target that includes the imported WatchKit source code
        
watchViewController.modalTransitionStyle = .crossDissolve
watchViewController.modalPresentationStyle = .overFullScreen
self.present(watchViewController, animated: true, completion: nil)

Supported Components

This was a 36-hour project, so it's only partial reimplementation of WatchKit. It supports WKInterfaceController, WKInterfaceGroup, WKInterfaceLabel, and WKInterfaceButton. It also supports most important storyboard components including colors, fonts, segues, IBOutlets, IBActions, and force touch Menu Items.