From 7a63e5098abfdb35ea94851ab0f8e7c4a15135d7 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Wed, 1 Jul 2020 18:07:11 -0400 Subject: [PATCH 1/8] Match the Color API to the native one --- Sources/TokamakCore/Tokens/Color.swift | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Sources/TokamakCore/Tokens/Color.swift b/Sources/TokamakCore/Tokens/Color.swift index 6ea9c8d7f..3892a20a0 100644 --- a/Sources/TokamakCore/Tokens/Color.swift +++ b/Sources/TokamakCore/Tokens/Color.swift @@ -24,26 +24,26 @@ public struct Color: Equatable { public let red: Double public let green: Double public let blue: Double - public let alpha: Double + public let opacity: Double public let space: Space - public init(red: Double, + public init(_ colorSpace: Space = .sRGB, + red: Double, green: Double, blue: Double, - alpha: Double, - space: Space = .sRGB) { + opacity: Double) { self.red = red self.green = green self.blue = blue - self.alpha = alpha - self.space = space + self.opacity = opacity + space = space } - public static var white = Color(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) - public static var black = Color(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0) - public static var red = Color(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0) - public static var green = Color(red: 0.0, green: 1.0, blue: 0.0, alpha: 1.0) - public static var blue = Color(red: 0.0, green: 0.0, blue: 1.0, alpha: 1.0) + public static var white = Color(red: 1.0, green: 1.0, blue: 1.0, opacity: 1.0) + public static var black = Color(red: 0.0, green: 0.0, blue: 0.0, opacity: 1.0) + public static var red = Color(red: 1.0, green: 0.0, blue: 0.0, opacity: 1.0) + public static var green = Color(red: 0.0, green: 1.0, blue: 0.0, opacity: 1.0) + public static var blue = Color(red: 0.0, green: 0.0, blue: 1.0, opacity: 1.0) } extension Color: ExpressibleByIntegerLiteral { @@ -52,7 +52,7 @@ extension Color: ExpressibleByIntegerLiteral { red = Double((bitMask & 0xFF0000) >> 16) / 255 green = Double((bitMask & 0x00FF00) >> 8) / 255 blue = Double(bitMask & 0x0000FF) / 255 - alpha = 1 + opacity = 1 space = .sRGB } } @@ -73,7 +73,7 @@ extension Color { self.red = Double(red) / 255 self.green = Double(green) / 255 self.blue = Double(blue) / 255 - alpha = 1 + opacity = 1 space = .sRGB } } From c1a8035a4f82e54422f89274ea9c01ba7a39bc5a Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Wed, 1 Jul 2020 18:21:55 -0400 Subject: [PATCH 2/8] Extract the demo view to its own file --- Sources/TokamakDemo/TextDemo.swift | 6 ++++ Sources/TokamakDemo/TokamakDemo.swift | 51 +++++++++++++++++++++++++++ Sources/TokamakDemo/main.swift | 38 +------------------- 3 files changed, 58 insertions(+), 37 deletions(-) create mode 100644 Sources/TokamakDemo/TokamakDemo.swift diff --git a/Sources/TokamakDemo/TextDemo.swift b/Sources/TokamakDemo/TextDemo.swift index 3cc00022d..9ea24d453 100644 --- a/Sources/TokamakDemo/TextDemo.swift +++ b/Sources/TokamakDemo/TextDemo.swift @@ -14,6 +14,12 @@ import TokamakDOM +struct CustomModifier: ViewModifier { + func body(content: Content) -> some View { + Text("Whole new body!") + } +} + struct TextDemo: View { var body: some View { VStack { diff --git a/Sources/TokamakDemo/TokamakDemo.swift b/Sources/TokamakDemo/TokamakDemo.swift new file mode 100644 index 000000000..b482940fa --- /dev/null +++ b/Sources/TokamakDemo/TokamakDemo.swift @@ -0,0 +1,51 @@ +// Copyright 2019-2020 Tokamak contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Created by Jed Fox on 07/01/2020. +// + +import TokamakDOM + +struct TokamakDemoView: View { + var body: some View { + ScrollView(showsIndicators: false) { + HStack { + Spacer() + } + VStack { + Counter(count: 5, limit: 15) + .padding() + .background(Color(red: 0.9, green: 0.9, blue: 0.9, alpha: 1.0)) + .border(Color.red, width: 3) + ZStack { + Text("I'm on bottom") + Text("I'm forced to the top") + .zIndex(1) + Text("I'm on top") + } + .padding(20) + ForEachDemo() + TextDemo() + SVGCircle() + .frame(width: 25, height: 25) + TextFieldDemo() + SpacerDemo() + Spacer() + Text("Forced to bottom.") + EnvironmentDemo() + .font(.system(size: 21)) + } + } + } +} diff --git a/Sources/TokamakDemo/main.swift b/Sources/TokamakDemo/main.swift index 586f33deb..ccc09755b 100644 --- a/Sources/TokamakDemo/main.swift +++ b/Sources/TokamakDemo/main.swift @@ -17,43 +17,7 @@ import TokamakDOM let document = JSObjectRef.global.document.object! -struct CustomModifier: ViewModifier { - func body(content: Content) -> some View { - Text("Whole new body!") - } -} - let div = document.createElement!("div").object! -let renderer = DOMRenderer( - ScrollView(showsIndicators: false) { - HStack { - Spacer() - } - VStack { - Counter(count: 5, limit: 15) - .padding() - .background(Color(red: 0.9, green: 0.9, blue: 0.9, alpha: 1.0)) - .border(Color.red, width: 3) - ZStack { - Text("I'm on bottom") - Text("I'm forced to the top") - .zIndex(1) - Text("I'm on top") - } - .padding(20) - ForEachDemo() - TextDemo() - SVGCircle() - .frame(width: 25, height: 25) - TextFieldDemo() - SpacerDemo() - Spacer() - Text("Forced to bottom.") - EnvironmentDemo() - .font(.system(size: 21)) - } - }, - div -) +let renderer = DOMRenderer(TokamakDemoView(), div) _ = document.body.object!.appendChild!(div) From 4bf9f64b14e94c96674d15d8b6ea82b9dd8f3939 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Wed, 1 Jul 2020 18:39:27 -0400 Subject: [PATCH 3/8] Add Xcode project and native targets --- Sources/TokamakDemo/Counter.swift | 4 + Sources/TokamakDemo/EnvironmentDemo.swift | 6 +- Sources/TokamakDemo/ForEachDemo.swift | 4 + Sources/TokamakDemo/SpacerDemo.swift | 4 + Sources/TokamakDemo/TextDemo.swift | 4 + Sources/TokamakDemo/TextFieldDemo.swift | 5 +- Sources/TokamakDemo/TokamakDemo.swift | 8 +- Tokamak Native/Info.plist | 30 ++ Tokamak Native/LaunchScreen.storyboard | 25 + Tokamak Native/NSAppDelegate.swift | 36 ++ .../Tokamak Native.xcodeproj/project.pbxproj | 469 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + Tokamak Native/UIAppDelegate.swift | 33 ++ Tokamak Native/UISceneDelegate.swift | 22 + Tokamak Native/iOS Info.plist | 50 ++ Tokamak Native/macOS.storyboard | 39 ++ 17 files changed, 751 insertions(+), 3 deletions(-) create mode 100644 Tokamak Native/Info.plist create mode 100644 Tokamak Native/LaunchScreen.storyboard create mode 100644 Tokamak Native/NSAppDelegate.swift create mode 100644 Tokamak Native/Tokamak Native.xcodeproj/project.pbxproj create mode 100644 Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Tokamak Native/UIAppDelegate.swift create mode 100644 Tokamak Native/UISceneDelegate.swift create mode 100644 Tokamak Native/iOS Info.plist create mode 100644 Tokamak Native/macOS.storyboard diff --git a/Sources/TokamakDemo/Counter.swift b/Sources/TokamakDemo/Counter.swift index 519279974..4bbbfdde0 100644 --- a/Sources/TokamakDemo/Counter.swift +++ b/Sources/TokamakDemo/Counter.swift @@ -15,7 +15,11 @@ // Created by Max Desiatov on 14/02/2019. // +#if canImport(SwiftUI) +import SwiftUI +#else import TokamakDOM +#endif public struct Counter: View { @State public var count: Int diff --git a/Sources/TokamakDemo/EnvironmentDemo.swift b/Sources/TokamakDemo/EnvironmentDemo.swift index 65e6d38ea..e0574dfc5 100644 --- a/Sources/TokamakDemo/EnvironmentDemo.swift +++ b/Sources/TokamakDemo/EnvironmentDemo.swift @@ -15,14 +15,18 @@ // Created by Carson Katri on 6/30/20. // +#if canImport(SwiftUI) +import SwiftUI +#else import TokamakDOM +#endif struct EnvironmentDemo: View { @Environment(\.font) var font: Font? var body: some View { if let font = font { - return Text("\(font)") + return Text("\(String(describing: font))") } else { return Text("`font` environment not set.") } diff --git a/Sources/TokamakDemo/ForEachDemo.swift b/Sources/TokamakDemo/ForEachDemo.swift index d0df80d88..6f08efa93 100644 --- a/Sources/TokamakDemo/ForEachDemo.swift +++ b/Sources/TokamakDemo/ForEachDemo.swift @@ -12,7 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if canImport(SwiftUI) +import SwiftUI +#else import TokamakDOM +#endif public struct ForEachDemo: View { @State public var items: [Int] = [] diff --git a/Sources/TokamakDemo/SpacerDemo.swift b/Sources/TokamakDemo/SpacerDemo.swift index 2404bba3e..f226d027c 100644 --- a/Sources/TokamakDemo/SpacerDemo.swift +++ b/Sources/TokamakDemo/SpacerDemo.swift @@ -15,7 +15,11 @@ // Created by Carson Katri on 6/29/20. // +#if canImport(SwiftUI) +import SwiftUI +#else import TokamakDOM +#endif struct SpacerDemo: View { var body: some View { diff --git a/Sources/TokamakDemo/TextDemo.swift b/Sources/TokamakDemo/TextDemo.swift index 9ea24d453..60c089342 100644 --- a/Sources/TokamakDemo/TextDemo.swift +++ b/Sources/TokamakDemo/TextDemo.swift @@ -12,7 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if canImport(SwiftUI) +import SwiftUI +#else import TokamakDOM +#endif struct CustomModifier: ViewModifier { func body(content: Content) -> some View { diff --git a/Sources/TokamakDemo/TextFieldDemo.swift b/Sources/TokamakDemo/TextFieldDemo.swift index 15f68c076..838b501c1 100644 --- a/Sources/TokamakDemo/TextFieldDemo.swift +++ b/Sources/TokamakDemo/TextFieldDemo.swift @@ -12,8 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -import TokamakCore +#if canImport(SwiftUI) +import SwiftUI +#else import TokamakDOM +#endif struct TextFieldDemo: View { @State var text = "" diff --git a/Sources/TokamakDemo/TokamakDemo.swift b/Sources/TokamakDemo/TokamakDemo.swift index b482940fa..68d98a926 100644 --- a/Sources/TokamakDemo/TokamakDemo.swift +++ b/Sources/TokamakDemo/TokamakDemo.swift @@ -15,7 +15,11 @@ // Created by Jed Fox on 07/01/2020. // +#if canImport(SwiftUI) +import SwiftUI +#else import TokamakDOM +#endif struct TokamakDemoView: View { var body: some View { @@ -26,7 +30,7 @@ struct TokamakDemoView: View { VStack { Counter(count: 5, limit: 15) .padding() - .background(Color(red: 0.9, green: 0.9, blue: 0.9, alpha: 1.0)) + .background(Color(red: 0.9, green: 0.9, blue: 0.9, opacity: 1.0)) .border(Color.red, width: 3) ZStack { Text("I'm on bottom") @@ -37,8 +41,10 @@ struct TokamakDemoView: View { .padding(20) ForEachDemo() TextDemo() + #if canImport(TokamakDOM) SVGCircle() .frame(width: 25, height: 25) + #endif TextFieldDemo() SpacerDemo() Spacer() diff --git a/Tokamak Native/Info.plist b/Tokamak Native/Info.plist new file mode 100644 index 000000000..1d0c0bd70 --- /dev/null +++ b/Tokamak Native/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSMainStoryboardFile + macOS + NSPrincipalClass + NSApplication + + diff --git a/Tokamak Native/LaunchScreen.storyboard b/Tokamak Native/LaunchScreen.storyboard new file mode 100644 index 000000000..865e9329f --- /dev/null +++ b/Tokamak Native/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tokamak Native/NSAppDelegate.swift b/Tokamak Native/NSAppDelegate.swift new file mode 100644 index 000000000..792fc8a55 --- /dev/null +++ b/Tokamak Native/NSAppDelegate.swift @@ -0,0 +1,36 @@ +// Copyright 2019-2020 Tokamak contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Created by Jed Fox on 07/01/2020. +// + +import Cocoa +import SwiftUI + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate { + var window: NSWindow! + + func applicationDidFinishLaunching(_ aNotification: Notification) { + window = NSWindow( + contentRect: NSRect(x: 0, y: 0, width: 480, height: 300), + styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView], + backing: .buffered, defer: false + ) + window.isReleasedWhenClosed = false + window.center() + window.contentView = NSHostingView(rootView: TokamakDemoView()) + window.makeKeyAndOrderFront(nil) + } +} diff --git a/Tokamak Native/Tokamak Native.xcodeproj/project.pbxproj b/Tokamak Native/Tokamak Native.xcodeproj/project.pbxproj new file mode 100644 index 000000000..b37ff8baa --- /dev/null +++ b/Tokamak Native/Tokamak Native.xcodeproj/project.pbxproj @@ -0,0 +1,469 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 85ED186A24AD38F20085DFA0 /* UIAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED186924AD38F20085DFA0 /* UIAppDelegate.swift */; }; + 85ED188A24AD3CD60085DFA0 /* macOS.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 85ED188724AD3CC30085DFA0 /* macOS.storyboard */; }; + 85ED188C24AD3CF10085DFA0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 85ED188B24AD3CF10085DFA0 /* LaunchScreen.storyboard */; }; + 85ED18A324AD425E0085DFA0 /* SpacerDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189A24AD425E0085DFA0 /* SpacerDemo.swift */; }; + 85ED18A424AD425E0085DFA0 /* SpacerDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189A24AD425E0085DFA0 /* SpacerDemo.swift */; }; + 85ED18A524AD425E0085DFA0 /* TextDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189B24AD425E0085DFA0 /* TextDemo.swift */; }; + 85ED18A624AD425E0085DFA0 /* TextDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189B24AD425E0085DFA0 /* TextDemo.swift */; }; + 85ED18A724AD425E0085DFA0 /* ForEachDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189C24AD425E0085DFA0 /* ForEachDemo.swift */; }; + 85ED18A824AD425E0085DFA0 /* ForEachDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189C24AD425E0085DFA0 /* ForEachDemo.swift */; }; + 85ED18A924AD425E0085DFA0 /* TokamakDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189D24AD425E0085DFA0 /* TokamakDemo.swift */; }; + 85ED18AA24AD425E0085DFA0 /* TokamakDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189D24AD425E0085DFA0 /* TokamakDemo.swift */; }; + 85ED18AB24AD425E0085DFA0 /* Counter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189E24AD425E0085DFA0 /* Counter.swift */; }; + 85ED18AC24AD425E0085DFA0 /* Counter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189E24AD425E0085DFA0 /* Counter.swift */; }; + 85ED18AD24AD425E0085DFA0 /* TextFieldDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189F24AD425E0085DFA0 /* TextFieldDemo.swift */; }; + 85ED18AE24AD425E0085DFA0 /* TextFieldDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189F24AD425E0085DFA0 /* TextFieldDemo.swift */; }; + 85ED18AF24AD425E0085DFA0 /* EnvironmentDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED18A024AD425E0085DFA0 /* EnvironmentDemo.swift */; }; + 85ED18B024AD425E0085DFA0 /* EnvironmentDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED18A024AD425E0085DFA0 /* EnvironmentDemo.swift */; }; + 85ED18B624AD42D70085DFA0 /* NSAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85ED189424AD41B90085DFA0 /* NSAppDelegate.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 85ED184A24AD379A0085DFA0 /* Tokamak Native.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Tokamak Native.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 85ED185224AD379A0085DFA0 /* Tokamak Native.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Tokamak Native.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 85ED186924AD38F20085DFA0 /* UIAppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIAppDelegate.swift; sourceTree = ""; }; + 85ED188724AD3CC30085DFA0 /* macOS.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = macOS.storyboard; sourceTree = ""; }; + 85ED188B24AD3CF10085DFA0 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; + 85ED189424AD41B90085DFA0 /* NSAppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSAppDelegate.swift; sourceTree = ""; }; + 85ED189A24AD425E0085DFA0 /* SpacerDemo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpacerDemo.swift; sourceTree = ""; }; + 85ED189B24AD425E0085DFA0 /* TextDemo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextDemo.swift; sourceTree = ""; }; + 85ED189C24AD425E0085DFA0 /* ForEachDemo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ForEachDemo.swift; sourceTree = ""; }; + 85ED189D24AD425E0085DFA0 /* TokamakDemo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokamakDemo.swift; sourceTree = ""; }; + 85ED189E24AD425E0085DFA0 /* Counter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Counter.swift; sourceTree = ""; }; + 85ED189F24AD425E0085DFA0 /* TextFieldDemo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldDemo.swift; sourceTree = ""; }; + 85ED18A024AD425E0085DFA0 /* EnvironmentDemo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnvironmentDemo.swift; sourceTree = ""; }; + 85ED18BD24AD46340085DFA0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 85ED18BF24AD464B0085DFA0 /* iOS Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iOS Info.plist"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 85ED184724AD379A0085DFA0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 85ED184F24AD379A0085DFA0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 85ED183D24AD37970085DFA0 = { + isa = PBXGroup; + children = ( + 85ED188B24AD3CF10085DFA0 /* LaunchScreen.storyboard */, + 85ED186924AD38F20085DFA0 /* UIAppDelegate.swift */, + 85ED189424AD41B90085DFA0 /* NSAppDelegate.swift */, + 85ED188724AD3CC30085DFA0 /* macOS.storyboard */, + 85ED18BF24AD464B0085DFA0 /* iOS Info.plist */, + 85ED18BD24AD46340085DFA0 /* Info.plist */, + 85ED189924AD425E0085DFA0 /* TokamakDemo */, + 85ED184B24AD379A0085DFA0 /* Products */, + ); + sourceTree = ""; + }; + 85ED184B24AD379A0085DFA0 /* Products */ = { + isa = PBXGroup; + children = ( + 85ED184A24AD379A0085DFA0 /* Tokamak Native.app */, + 85ED185224AD379A0085DFA0 /* Tokamak Native.app */, + ); + name = Products; + sourceTree = ""; + }; + 85ED189924AD425E0085DFA0 /* TokamakDemo */ = { + isa = PBXGroup; + children = ( + 85ED189A24AD425E0085DFA0 /* SpacerDemo.swift */, + 85ED189B24AD425E0085DFA0 /* TextDemo.swift */, + 85ED189C24AD425E0085DFA0 /* ForEachDemo.swift */, + 85ED189D24AD425E0085DFA0 /* TokamakDemo.swift */, + 85ED189E24AD425E0085DFA0 /* Counter.swift */, + 85ED189F24AD425E0085DFA0 /* TextFieldDemo.swift */, + 85ED18A024AD425E0085DFA0 /* EnvironmentDemo.swift */, + ); + name = TokamakDemo; + path = ../Sources/TokamakDemo; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 85ED184924AD379A0085DFA0 /* iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 85ED185E24AD379B0085DFA0 /* Build configuration list for PBXNativeTarget "iOS" */; + buildPhases = ( + 85ED184624AD379A0085DFA0 /* Sources */, + 85ED184724AD379A0085DFA0 /* Frameworks */, + 85ED184824AD379A0085DFA0 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = iOS; + productName = iOS; + productReference = 85ED184A24AD379A0085DFA0 /* Tokamak Native.app */; + productType = "com.apple.product-type.application"; + }; + 85ED185124AD379A0085DFA0 /* macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 85ED186124AD379B0085DFA0 /* Build configuration list for PBXNativeTarget "macOS" */; + buildPhases = ( + 85ED184E24AD379A0085DFA0 /* Sources */, + 85ED184F24AD379A0085DFA0 /* Frameworks */, + 85ED185024AD379A0085DFA0 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = macOS; + productName = macOS; + productReference = 85ED185224AD379A0085DFA0 /* Tokamak Native.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 85ED183E24AD37970085DFA0 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1200; + LastUpgradeCheck = 1200; + TargetAttributes = { + 85ED184924AD379A0085DFA0 = { + CreatedOnToolsVersion = 12.0; + LastSwiftMigration = 1200; + }; + 85ED185124AD379A0085DFA0 = { + CreatedOnToolsVersion = 12.0; + LastSwiftMigration = 1200; + }; + }; + }; + buildConfigurationList = 85ED184124AD37970085DFA0 /* Build configuration list for PBXProject "Tokamak Native" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 85ED183D24AD37970085DFA0; + productRefGroup = 85ED184B24AD379A0085DFA0 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 85ED184924AD379A0085DFA0 /* iOS */, + 85ED185124AD379A0085DFA0 /* macOS */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 85ED184824AD379A0085DFA0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 85ED188C24AD3CF10085DFA0 /* LaunchScreen.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 85ED185024AD379A0085DFA0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 85ED188A24AD3CD60085DFA0 /* macOS.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 85ED184624AD379A0085DFA0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 85ED186A24AD38F20085DFA0 /* UIAppDelegate.swift in Sources */, + 85ED18AF24AD425E0085DFA0 /* EnvironmentDemo.swift in Sources */, + 85ED18A324AD425E0085DFA0 /* SpacerDemo.swift in Sources */, + 85ED18A924AD425E0085DFA0 /* TokamakDemo.swift in Sources */, + 85ED18AD24AD425E0085DFA0 /* TextFieldDemo.swift in Sources */, + 85ED18A724AD425E0085DFA0 /* ForEachDemo.swift in Sources */, + 85ED18A524AD425E0085DFA0 /* TextDemo.swift in Sources */, + 85ED18AB24AD425E0085DFA0 /* Counter.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 85ED184E24AD379A0085DFA0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 85ED18AA24AD425E0085DFA0 /* TokamakDemo.swift in Sources */, + 85ED18A424AD425E0085DFA0 /* SpacerDemo.swift in Sources */, + 85ED18B024AD425E0085DFA0 /* EnvironmentDemo.swift in Sources */, + 85ED18B624AD42D70085DFA0 /* NSAppDelegate.swift in Sources */, + 85ED18AC24AD425E0085DFA0 /* Counter.swift in Sources */, + 85ED18A824AD425E0085DFA0 /* ForEachDemo.swift in Sources */, + 85ED18AE24AD425E0085DFA0 /* TextFieldDemo.swift in Sources */, + 85ED18A624AD425E0085DFA0 /* TextDemo.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 85ED185C24AD379B0085DFA0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.jedfox.Tokamak-Native"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 85ED185D24AD379B0085DFA0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.jedfox.Tokamak-Native"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 85ED185F24AD379B0085DFA0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 288H3WAR3W; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = "iOS Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_NAME = "Tokamak Native"; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 85ED186024AD379B0085DFA0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 288H3WAR3W; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = "iOS Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_NAME = "Tokamak Native"; + SDKROOT = iphoneos; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 85ED186224AD379B0085DFA0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = ""; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 288H3WAR3W; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.15; + PRODUCT_NAME = "Tokamak Native"; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 85ED186324AD379B0085DFA0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = ""; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 288H3WAR3W; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.15; + PRODUCT_NAME = "Tokamak Native"; + SDKROOT = macosx; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 85ED184124AD37970085DFA0 /* Build configuration list for PBXProject "Tokamak Native" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 85ED185C24AD379B0085DFA0 /* Debug */, + 85ED185D24AD379B0085DFA0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 85ED185E24AD379B0085DFA0 /* Build configuration list for PBXNativeTarget "iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 85ED185F24AD379B0085DFA0 /* Debug */, + 85ED186024AD379B0085DFA0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 85ED186124AD379B0085DFA0 /* Build configuration list for PBXNativeTarget "macOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 85ED186224AD379B0085DFA0 /* Debug */, + 85ED186324AD379B0085DFA0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 85ED183E24AD37970085DFA0 /* Project object */; +} diff --git a/Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..c85d5cba2 --- /dev/null +++ b/Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Tokamak Native/UIAppDelegate.swift b/Tokamak Native/UIAppDelegate.swift new file mode 100644 index 000000000..1599a944f --- /dev/null +++ b/Tokamak Native/UIAppDelegate.swift @@ -0,0 +1,33 @@ +// Copyright 2019-2020 Tokamak contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Created by Jed Fox on 07/01/2020. +// + +import SwiftUI +import UIKit + +// so we only need one Info.plist +public class NSApplication: UIApplication {} + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + let window = UIWindow() + func application(_ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { + window.rootViewController = UIHostingController(rootView: TokamakDemoView()) + window.makeKeyAndVisible() + return true + } +} diff --git a/Tokamak Native/UISceneDelegate.swift b/Tokamak Native/UISceneDelegate.swift new file mode 100644 index 000000000..6d0c15098 --- /dev/null +++ b/Tokamak Native/UISceneDelegate.swift @@ -0,0 +1,22 @@ +// +// SceneDelegate.swift +// SwiftWebUI Compat Test +// +// Created by Jed Fox on 6/27/20. +// + +import SwiftUI +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + var window: UIWindow? + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + if let windowScene = scene as? UIWindowScene { + let window = UIWindow(windowScene: windowScene) + window.rootViewController = UIHostingController(rootView: TokamakDemoView()) + self.window = window + window.makeKeyAndVisible() + } + } +} diff --git a/Tokamak Native/iOS Info.plist b/Tokamak Native/iOS Info.plist new file mode 100644 index 000000000..039462480 --- /dev/null +++ b/Tokamak Native/iOS Info.plist @@ -0,0 +1,50 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Tokamak Native/macOS.storyboard b/Tokamak Native/macOS.storyboard new file mode 100644 index 000000000..5fad33b18 --- /dev/null +++ b/Tokamak Native/macOS.storyboard @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 091b26d9798f38ca96d3e404c061e0e2d8893de6 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Wed, 1 Jul 2020 18:42:48 -0400 Subject: [PATCH 4/8] Fix Color --- Sources/TokamakCore/Tokens/Color.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/TokamakCore/Tokens/Color.swift b/Sources/TokamakCore/Tokens/Color.swift index 3892a20a0..92ed7d8d4 100644 --- a/Sources/TokamakCore/Tokens/Color.swift +++ b/Sources/TokamakCore/Tokens/Color.swift @@ -36,7 +36,7 @@ public struct Color: Equatable { self.green = green self.blue = blue self.opacity = opacity - space = space + space = colorSpace } public static var white = Color(red: 1.0, green: 1.0, blue: 1.0, opacity: 1.0) From 1c18f54eed4eefe57bcd1cde3270e03cbd9f582f Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Wed, 1 Jul 2020 18:43:26 -0400 Subject: [PATCH 5/8] Delete UISceneDelegate.swift --- Tokamak Native/UISceneDelegate.swift | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 Tokamak Native/UISceneDelegate.swift diff --git a/Tokamak Native/UISceneDelegate.swift b/Tokamak Native/UISceneDelegate.swift deleted file mode 100644 index 6d0c15098..000000000 --- a/Tokamak Native/UISceneDelegate.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// SceneDelegate.swift -// SwiftWebUI Compat Test -// -// Created by Jed Fox on 6/27/20. -// - -import SwiftUI -import UIKit - -class SceneDelegate: UIResponder, UIWindowSceneDelegate { - var window: UIWindow? - - func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { - if let windowScene = scene as? UIWindowScene { - let window = UIWindow(windowScene: windowScene) - window.rootViewController = UIHostingController(rootView: TokamakDemoView()) - self.window = window - window.makeKeyAndVisible() - } - } -} From a3e79e257fd19de9bdacddec718d883d361c0157 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Wed, 1 Jul 2020 19:31:08 -0400 Subject: [PATCH 6/8] Fix line length --- Tokamak Native/UIAppDelegate.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tokamak Native/UIAppDelegate.swift b/Tokamak Native/UIAppDelegate.swift index 1599a944f..94e6e45da 100644 --- a/Tokamak Native/UIAppDelegate.swift +++ b/Tokamak Native/UIAppDelegate.swift @@ -24,8 +24,10 @@ public class NSApplication: UIApplication {} @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { let window = UIWindow() - func application(_ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { + func application( + _: UIApplication, + didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil + ) -> Bool { window.rootViewController = UIHostingController(rootView: TokamakDemoView()) window.makeKeyAndVisible() return true From 4270c018a9284106dd551905b5336de8df757c36 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Wed, 1 Jul 2020 20:31:24 -0400 Subject: [PATCH 7/8] =?UTF-8?q?Tokamak=20Native=20=E2=86=92=20TokamakDemo?= =?UTF-8?q?=20Native?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Info.plist | 0 .../LaunchScreen.storyboard | 0 .../NSAppDelegate.swift | 0 .../project.pbxproj | 24 +++++++++---------- .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../UIAppDelegate.swift | 0 .../iOS Info.plist | 0 .../macOS.storyboard | 6 ++--- 9 files changed, 15 insertions(+), 15 deletions(-) rename {Tokamak Native => TokamakDemo Native}/Info.plist (100%) rename {Tokamak Native => TokamakDemo Native}/LaunchScreen.storyboard (100%) rename {Tokamak Native => TokamakDemo Native}/NSAppDelegate.swift (100%) rename {Tokamak Native/Tokamak Native.xcodeproj => TokamakDemo Native/TokamakDemo Native.xcodeproj}/project.pbxproj (95%) rename {Tokamak Native/Tokamak Native.xcodeproj => TokamakDemo Native/TokamakDemo Native.xcodeproj}/project.xcworkspace/contents.xcworkspacedata (100%) rename {Tokamak Native/Tokamak Native.xcodeproj => TokamakDemo Native/TokamakDemo Native.xcodeproj}/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {Tokamak Native => TokamakDemo Native}/UIAppDelegate.swift (100%) rename {Tokamak Native => TokamakDemo Native}/iOS Info.plist (100%) rename {Tokamak Native => TokamakDemo Native}/macOS.storyboard (91%) diff --git a/Tokamak Native/Info.plist b/TokamakDemo Native/Info.plist similarity index 100% rename from Tokamak Native/Info.plist rename to TokamakDemo Native/Info.plist diff --git a/Tokamak Native/LaunchScreen.storyboard b/TokamakDemo Native/LaunchScreen.storyboard similarity index 100% rename from Tokamak Native/LaunchScreen.storyboard rename to TokamakDemo Native/LaunchScreen.storyboard diff --git a/Tokamak Native/NSAppDelegate.swift b/TokamakDemo Native/NSAppDelegate.swift similarity index 100% rename from Tokamak Native/NSAppDelegate.swift rename to TokamakDemo Native/NSAppDelegate.swift diff --git a/Tokamak Native/Tokamak Native.xcodeproj/project.pbxproj b/TokamakDemo Native/TokamakDemo Native.xcodeproj/project.pbxproj similarity index 95% rename from Tokamak Native/Tokamak Native.xcodeproj/project.pbxproj rename to TokamakDemo Native/TokamakDemo Native.xcodeproj/project.pbxproj index b37ff8baa..0bd67c0cd 100644 --- a/Tokamak Native/Tokamak Native.xcodeproj/project.pbxproj +++ b/TokamakDemo Native/TokamakDemo Native.xcodeproj/project.pbxproj @@ -28,8 +28,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 85ED184A24AD379A0085DFA0 /* Tokamak Native.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Tokamak Native.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 85ED185224AD379A0085DFA0 /* Tokamak Native.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Tokamak Native.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 85ED184A24AD379A0085DFA0 /* TokamakDemo Native.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TokamakDemo Native.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 85ED185224AD379A0085DFA0 /* TokamakDemo Native.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TokamakDemo Native.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 85ED186924AD38F20085DFA0 /* UIAppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIAppDelegate.swift; sourceTree = ""; }; 85ED188724AD3CC30085DFA0 /* macOS.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = macOS.storyboard; sourceTree = ""; }; 85ED188B24AD3CF10085DFA0 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; @@ -80,8 +80,8 @@ 85ED184B24AD379A0085DFA0 /* Products */ = { isa = PBXGroup; children = ( - 85ED184A24AD379A0085DFA0 /* Tokamak Native.app */, - 85ED185224AD379A0085DFA0 /* Tokamak Native.app */, + 85ED184A24AD379A0085DFA0 /* TokamakDemo Native.app */, + 85ED185224AD379A0085DFA0 /* TokamakDemo Native.app */, ); name = Products; sourceTree = ""; @@ -118,7 +118,7 @@ ); name = iOS; productName = iOS; - productReference = 85ED184A24AD379A0085DFA0 /* Tokamak Native.app */; + productReference = 85ED184A24AD379A0085DFA0 /* TokamakDemo Native.app */; productType = "com.apple.product-type.application"; }; 85ED185124AD379A0085DFA0 /* macOS */ = { @@ -135,7 +135,7 @@ ); name = macOS; productName = macOS; - productReference = 85ED185224AD379A0085DFA0 /* Tokamak Native.app */; + productReference = 85ED185224AD379A0085DFA0 /* TokamakDemo Native.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -157,7 +157,7 @@ }; }; }; - buildConfigurationList = 85ED184124AD37970085DFA0 /* Build configuration list for PBXProject "Tokamak Native" */; + buildConfigurationList = 85ED184124AD37970085DFA0 /* Build configuration list for PBXProject "TokamakDemo Native" */; compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; @@ -356,7 +356,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_NAME = "Tokamak Native"; + PRODUCT_NAME = "TokamakDemo Native"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -378,7 +378,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_NAME = "Tokamak Native"; + PRODUCT_NAME = "TokamakDemo Native"; SDKROOT = iphoneos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -403,7 +403,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - PRODUCT_NAME = "Tokamak Native"; + PRODUCT_NAME = "TokamakDemo Native"; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -427,7 +427,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - PRODUCT_NAME = "Tokamak Native"; + PRODUCT_NAME = "TokamakDemo Native"; SDKROOT = macosx; SWIFT_VERSION = 5.0; }; @@ -436,7 +436,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 85ED184124AD37970085DFA0 /* Build configuration list for PBXProject "Tokamak Native" */ = { + 85ED184124AD37970085DFA0 /* Build configuration list for PBXProject "TokamakDemo Native" */ = { isa = XCConfigurationList; buildConfigurations = ( 85ED185C24AD379B0085DFA0 /* Debug */, diff --git a/Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/TokamakDemo Native/TokamakDemo Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to TokamakDemo Native/TokamakDemo Native.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/TokamakDemo Native/TokamakDemo Native.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from Tokamak Native/Tokamak Native.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to TokamakDemo Native/TokamakDemo Native.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Tokamak Native/UIAppDelegate.swift b/TokamakDemo Native/UIAppDelegate.swift similarity index 100% rename from Tokamak Native/UIAppDelegate.swift rename to TokamakDemo Native/UIAppDelegate.swift diff --git a/Tokamak Native/iOS Info.plist b/TokamakDemo Native/iOS Info.plist similarity index 100% rename from Tokamak Native/iOS Info.plist rename to TokamakDemo Native/iOS Info.plist diff --git a/Tokamak Native/macOS.storyboard b/TokamakDemo Native/macOS.storyboard similarity index 91% rename from Tokamak Native/macOS.storyboard rename to TokamakDemo Native/macOS.storyboard index 5fad33b18..0ba82aa24 100644 --- a/Tokamak Native/macOS.storyboard +++ b/TokamakDemo Native/macOS.storyboard @@ -11,11 +11,11 @@ - + - + - + From 68b1eeaf0901ec26537ddaa16dce380c21a04413 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Thu, 2 Jul 2020 09:15:51 -0400 Subject: [PATCH 8/8] Add exports for styles, fix typo --- Sources/TokamakDOM/Styles/Styles.swift | 23 +++++++++++++++++++++++ Sources/TokamakDOM/Tokens/Tokens.swift | 2 +- Sources/TokamakDemo/TextFieldDemo.swift | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Sources/TokamakDOM/Styles/Styles.swift diff --git a/Sources/TokamakDOM/Styles/Styles.swift b/Sources/TokamakDOM/Styles/Styles.swift new file mode 100644 index 000000000..638ae0e78 --- /dev/null +++ b/Sources/TokamakDOM/Styles/Styles.swift @@ -0,0 +1,23 @@ +// Copyright 2020 Tokamak contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Created by Jed Fox on 06/30/2020. +// + +import TokamakCore + +public typealias DefaultTextFieldStyle = TokamakCore.DefaultTextFieldStyle +public typealias PlainTextFieldStyle = TokamakCore.PlainTextFieldStyle +public typealias RoundedBorderTextFieldStyle = TokamakCore.RoundedBorderTextFieldStyle +public typealias SquareBorderTextFieldStyle = TokamakCore.SquareBorderTextFieldStyle diff --git a/Sources/TokamakDOM/Tokens/Tokens.swift b/Sources/TokamakDOM/Tokens/Tokens.swift index bdf90fef6..69ca84423 100644 --- a/Sources/TokamakDOM/Tokens/Tokens.swift +++ b/Sources/TokamakDOM/Tokens/Tokens.swift @@ -19,7 +19,7 @@ public typealias Color = TokamakCore.Color extension Color: CustomStringConvertible { public var description: String { - "rgb(\(red * 255), \(green * 255), \(blue * 255), \(alpha * 255))" + "rgb(\(red * 255), \(green * 255), \(blue * 255), \(opacity * 255))" } } diff --git a/Sources/TokamakDemo/TextFieldDemo.swift b/Sources/TokamakDemo/TextFieldDemo.swift index 838b501c1..b9acaf4b4 100644 --- a/Sources/TokamakDemo/TextFieldDemo.swift +++ b/Sources/TokamakDemo/TextFieldDemo.swift @@ -15,6 +15,7 @@ #if canImport(SwiftUI) import SwiftUI #else +import TokamakCore import TokamakDOM #endif