-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
141 changed files
with
6,295 additions
and
1,383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
.DS_Store | ||
|
||
## Xcode workspace | ||
*.xcworkspace | ||
#*.xcworkspace | ||
|
||
## Build generated | ||
build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
</array> | ||
<key>WKWatchKitApp</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="19158" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="AgC-eL-Hgc"> | ||
<device id="watch38"/> | ||
<dependencies> | ||
<deployment identifier="watchOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19141"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="19040"/> | ||
</dependencies> | ||
<scenes> | ||
<!--Root Interface Controller--> | ||
<scene sceneID="aou-V4-d1y"> | ||
<objects> | ||
<controller id="AgC-eL-Hgc" customClass="RootInterfaceController" customModule="watchOS_Ext_2"/> | ||
</objects> | ||
<point key="canvasLocation" x="-17" y="-6"/> | ||
</scene> | ||
</scenes> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionAttributes</key> | ||
<dict> | ||
<key>WKAppBundleIdentifier</key> | ||
<string>com.viewinspector.watchOS1.watchkitapp</string> | ||
</dict> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.watchkit</string> | ||
</dict> | ||
<key>WKWatchOnly</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionAttributes</key> | ||
<dict> | ||
<key>WKAppBundleIdentifier</key> | ||
<string>com.viewinspector.watchOS2.watchkitapp</string> | ||
</dict> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.watchkit</string> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import SwiftUI | ||
import WatchKit | ||
import Combine | ||
|
||
#if !(os(watchOS) && DEBUG) | ||
|
||
typealias RootView<T> = T | ||
typealias TestViewSubject = Set<Int> | ||
|
||
extension View { | ||
@inline(__always) | ||
func testable(_ injector: TestViewSubject) -> Self { | ||
self | ||
} | ||
} | ||
|
||
#else | ||
|
||
typealias RootView<T> = ModifiedContent<T, TestViewHost> | ||
typealias TestViewSubject = CurrentValueSubject<[(String, AnyView)], Never> | ||
|
||
extension View { | ||
func testable(_ injector: TestViewSubject) -> ModifiedContent<Self, TestViewHost> { | ||
modifier(TestViewHost(injector: injector)) | ||
} | ||
} | ||
|
||
struct TestViewHost: ViewModifier { | ||
|
||
@State private var hostedViews: [(String, AnyView)] = [] | ||
let injector: TestViewSubject | ||
|
||
func body(content: Content) -> some View { | ||
ZStack { | ||
content | ||
ForEach(hostedViews, id: \.0) { $0.1 } | ||
} | ||
.onReceive(injector) { hostedViews = $0 } | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import SwiftUI | ||
|
||
@main | ||
struct watchOSApp: App { | ||
|
||
// swiftlint:disable weak_delegate | ||
@WKExtensionDelegateAdaptor(ExtensionDelegate.self) var extDelegate | ||
// swiftlint:enable weak_delegate | ||
|
||
var body: some Scene { | ||
WindowGroup { | ||
NavigationView { | ||
Text("Hi") | ||
} | ||
.testable(extDelegate.testViewSubject) | ||
} | ||
} | ||
} | ||
|
||
final class ExtensionDelegate: NSObject, WKExtensionDelegate { | ||
let testViewSubject = TestViewSubject([]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import WatchKit | ||
import SwiftUI | ||
|
||
final class RootInterfaceController: WKHostingController<RootView<ContentView>> { | ||
|
||
let testViewSubject = TestViewSubject([]) | ||
|
||
override var body: RootView<ContentView> { | ||
return ContentView() | ||
.testable(testViewSubject) | ||
} | ||
} | ||
|
||
struct ContentView: View { | ||
var body: some View { | ||
Text("Hi") | ||
} | ||
} |
Oops, something went wrong.