Skip to content

Commit 0955bae

Browse files
author
Alex Usbergo
committed
demo
1 parent e43a8a7 commit 0955bae

File tree

7 files changed

+47
-68
lines changed

7 files changed

+47
-68
lines changed

Demo/CoreRenderDemo.xcodeproj/project.pbxproj

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,24 @@
1010
16216E7C2392D792009EDD08 /* Render in Frameworks */ = {isa = PBXBuildFile; productRef = 16216E7B2392D792009EDD08 /* Render */; };
1111
16216E7E2392D792009EDD08 /* CoreRender in Frameworks */ = {isa = PBXBuildFile; productRef = 16216E7D2392D792009EDD08 /* CoreRender */; };
1212
1622F3D223687938007C7E00 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1622F3D123687938007C7E00 /* AppDelegate.swift */; };
13-
1622F3D623687938007C7E00 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1622F3D523687938007C7E00 /* ContentView.swift */; };
1413
1622F3D82368793A007C7E00 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1622F3D72368793A007C7E00 /* Assets.xcassets */; };
1514
1622F3DB2368793A007C7E00 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1622F3DA2368793A007C7E00 /* Preview Assets.xcassets */; };
1615
1622F3DE2368793A007C7E00 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1622F3DC2368793A007C7E00 /* LaunchScreen.storyboard */; };
1716
1622F3E623687988007C7E00 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1622F3E523687988007C7E00 /* ViewController.swift */; };
17+
16569BF523A3902E00DB15A1 /* SwiftUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16569BF423A3902E00DB15A1 /* SwiftUIView.swift */; };
1818
16E97B6623687C3D00CEFB67 /* DemoWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16E97B6523687C3D00CEFB67 /* DemoWidget.swift */; };
1919
/* End PBXBuildFile section */
2020

2121
/* Begin PBXFileReference section */
2222
1622F3CE23687938007C7E00 /* CoreRenderDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CoreRenderDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
2323
1622F3D123687938007C7E00 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
24-
1622F3D523687938007C7E00 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
2524
1622F3D72368793A007C7E00 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2625
1622F3DA2368793A007C7E00 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
2726
1622F3DD2368793A007C7E00 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
2827
1622F3DF2368793A007C7E00 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2928
1622F3E523687988007C7E00 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
29+
16569BEF23A38E6400DB15A1 /* CoreRenderDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = CoreRenderDemo.entitlements; sourceTree = "<group>"; };
30+
16569BF423A3902E00DB15A1 /* SwiftUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIView.swift; sourceTree = "<group>"; };
3031
16E97B6523687C3D00CEFB67 /* DemoWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoWidget.swift; sourceTree = "<group>"; };
3132
/* End PBXFileReference section */
3233

@@ -62,9 +63,10 @@
6263
1622F3D023687938007C7E00 /* CoreRenderDemo */ = {
6364
isa = PBXGroup;
6465
children = (
66+
16569BEF23A38E6400DB15A1 /* CoreRenderDemo.entitlements */,
67+
16569BF423A3902E00DB15A1 /* SwiftUIView.swift */,
6568
1622F3D123687938007C7E00 /* AppDelegate.swift */,
6669
16E97B6523687C3D00CEFB67 /* DemoWidget.swift */,
67-
1622F3D523687938007C7E00 /* ContentView.swift */,
6870
1622F3E523687988007C7E00 /* ViewController.swift */,
6971
1622F3D72368793A007C7E00 /* Assets.xcassets */,
7072
1622F3DC2368793A007C7E00 /* LaunchScreen.storyboard */,
@@ -163,7 +165,7 @@
163165
1622F3D223687938007C7E00 /* AppDelegate.swift in Sources */,
164166
1622F3E623687988007C7E00 /* ViewController.swift in Sources */,
165167
16E97B6623687C3D00CEFB67 /* DemoWidget.swift in Sources */,
166-
1622F3D623687938007C7E00 /* ContentView.swift in Sources */,
168+
16569BF523A3902E00DB15A1 /* SwiftUIView.swift in Sources */,
167169
);
168170
runOnlyForDeploymentPostprocessing = 0;
169171
};
@@ -299,7 +301,9 @@
299301
isa = XCBuildConfiguration;
300302
buildSettings = {
301303
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
304+
CODE_SIGN_ENTITLEMENTS = CoreRenderDemo/CoreRenderDemo.entitlements;
302305
CODE_SIGN_STYLE = Automatic;
306+
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
303307
DEVELOPMENT_ASSET_PATHS = "\"CoreRenderDemo/Preview Content\"";
304308
DEVELOPMENT_TEAM = 9Z67YL2L6Z;
305309
ENABLE_PREVIEWS = YES;
@@ -310,6 +314,7 @@
310314
);
311315
PRODUCT_BUNDLE_IDENTIFIER = io.coreRender.CoreRenderDemo;
312316
PRODUCT_NAME = "$(TARGET_NAME)";
317+
SUPPORTS_MACCATALYST = YES;
313318
SWIFT_VERSION = 5.0;
314319
TARGETED_DEVICE_FAMILY = "1,2";
315320
};
@@ -319,7 +324,9 @@
319324
isa = XCBuildConfiguration;
320325
buildSettings = {
321326
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
327+
CODE_SIGN_ENTITLEMENTS = CoreRenderDemo/CoreRenderDemo.entitlements;
322328
CODE_SIGN_STYLE = Automatic;
329+
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
323330
DEVELOPMENT_ASSET_PATHS = "\"CoreRenderDemo/Preview Content\"";
324331
DEVELOPMENT_TEAM = 9Z67YL2L6Z;
325332
ENABLE_PREVIEWS = YES;
@@ -330,6 +337,7 @@
330337
);
331338
PRODUCT_BUNDLE_IDENTIFIER = io.coreRender.CoreRenderDemo;
332339
PRODUCT_NAME = "$(TARGET_NAME)";
340+
SUPPORTS_MACCATALYST = YES;
333341
SWIFT_VERSION = 5.0;
334342
TARGETED_DEVICE_FAMILY = "1,2";
335343
};

Demo/CoreRenderDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/CoreRenderDemo/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
4343
options connectionOptions: UIScene.ConnectionOptions) {
4444

4545
if (useSwiftUI) {
46-
let contentView = ContentView()
46+
let contentView = SwiftUIView()
4747
// Use a UIHostingCoordinator as window root view coordinator.
4848
if let windowScene = scene as? UIWindowScene {
4949
let window = UIWindow(windowScene: windowScene)

Demo/CoreRenderDemo/ContentView.swift

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.network.client</key>
8+
<true/>
9+
</dict>
10+
</plist>

Demo/CoreRenderDemo/DemoWidget.swift

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ class DemoWidgetCoordinator: Coordinator {
2525
}
2626

2727
override func onTouchUp(inside sender: UIView) {
28-
if sender === view(withKey: Const.increaseButtonKey) {
29-
self.increase()
30-
}
28+
self.increase()
3129
}
3230
}
3331

@@ -50,12 +48,8 @@ func makeDemoWidget(context: Context, coordinator: DemoWidgetCoordinator) -> Opa
5048
.textColor(.systemRed)
5149
.height(Const.size)
5250
.margin(Const.margin)
53-
.userInteractionEnabled(true)
54-
.onTouchUpInside { _ in
55-
coordinator.doSomeFunkyStuff()
56-
}
5751
HStackNode {
58-
ButtonNode(key: Const.increaseButtonKey, target: coordinator)
52+
ButtonNode(reuseIdentifier: Const.increaseButtonKey, target: coordinator)
5953
.text("TAP HERE TO INCREASE THE COUNTER")
6054
.font(UIFont.systemFont(ofSize: 12, weight: .bold))
6155
.background(.systemIndigo)
@@ -68,23 +62,6 @@ func makeDemoWidget(context: Context, coordinator: DemoWidgetCoordinator) -> Opa
6862
.matchHostingViewWidth(withMargin: 0)
6963
}
7064

71-
// MARK: - Manual View Manipulation Example
72-
73-
extension DemoWidgetCoordinator {
74-
// Example of manual access to the underlying view hierarchy.
75-
// Transitions can be performed in the node description as well, this is just an
76-
// example of manual view hierarchy manipulation.
77-
func doSomeFunkyStuff() {
78-
let transform = isRotated
79-
? CGAffineTransform.identity
80-
: CGAffineTransform.init(rotationAngle: .pi)
81-
isRotated.toggle()
82-
UIView.animate(withDuration: 1) {
83-
self.view(withKey: Const.increaseButtonKey)?.transform = transform
84-
}
85-
}
86-
}
87-
8865
// MARK: - Constants
8966

9067
private struct Const {

Demo/CoreRenderDemo/SwiftUIView.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import SwiftUI
2+
import CoreRender
3+
import Render
4+
5+
struct SwiftUIView: View {
6+
var body: some View {
7+
VStack {
8+
CoreRenderBridgeView { _ in
9+
LabelNode(text: "Hi from Render")
10+
.font(UIFont.systemFont(ofSize: 12))
11+
.padding(12)
12+
}
13+
}
14+
}
15+
}
16+
17+
struct SwiftUIView_Previews: PreviewProvider {
18+
static var previews: some View {
19+
SwiftUIView()
20+
}
21+
}

0 commit comments

Comments
 (0)