Skip to content

Commit 59026f7

Browse files
committed
fix(canvas-ios): use build as xcframework
1 parent 5e8282b commit 59026f7

File tree

59 files changed

+18958
-624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+18958
-624
lines changed

packages/canvas/README.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# NativeScript Canvas
22

33
**Powered by**
4-
* [CanvasNative](src-native/canvas-native) - Rust
5-
* [CanvasNative](src-native/canvas-ios) - IOS
6-
* [CanvasNative](src-native/canvas-android) - Android
4+
5+
- [CanvasNative](src-native/canvas-native) - Rust
6+
- [CanvasNative](src-native/canvas-ios) - IOS
7+
- [CanvasNative](src-native/canvas-android) - Android
8+
79
## Installation
810

911
```bash
1012
ns plugin add @nativescript/canvas
1113
```
1214

13-
_Note_ min ios support 10 | min android support 17
15+
_Note_ min ios support 11 | min android support 17
1416

1517
IMPORTANT: ensure you include xmlns:canvas="@nativescript/canvas" on the Page element for core {N}
1618

@@ -21,43 +23,41 @@ IMPORTANT: ensure you include xmlns:canvas="@nativescript/canvas" on the Page el
2123
```
2224

2325
### 2D
26+
2427
```typescript
2528
let ctx;
2629
let canvas;
2730
export function canvasReady(args) {
28-
console.log('canvas ready');
29-
canvas = args.object;
30-
console.log(canvas);
31-
ctx = canvas.getContext('2d');
32-
ctx.fillStyle = 'green';
33-
ctx.fillRect(10, 10, 150, 100);
31+
console.log('canvas ready');
32+
canvas = args.object;
33+
console.log(canvas);
34+
ctx = canvas.getContext('2d');
35+
ctx.fillStyle = 'green';
36+
ctx.fillRect(10, 10, 150, 100);
3437
}
3538
```
3639

37-
38-
3940
### WEBGL
41+
4042
```typescript
4143
let gl;
4244
let canvas;
4345
export function canvasReady(args) {
44-
console.log('canvas ready');
45-
canvas = args.object;
46-
gl = canvas.getContext('webgl'); // 'webgl' || 'webgl2'
47-
gl.viewport(0, 0,
48-
gl.drawingBufferWidth, gl.drawingBufferHeight);
49-
// Set the clear color to darkish green.
50-
gl.clearColor(0.0, 0.5, 0.0, 1.0);
51-
// Clear the context with the newly set color. This is
52-
// the function call that actually does the drawing.
53-
gl.clear(gl.COLOR_BUFFER_BIT);
54-
canvas.flush(); // must be called to draw on screen
46+
console.log('canvas ready');
47+
canvas = args.object;
48+
gl = canvas.getContext('webgl'); // 'webgl' || 'webgl2'
49+
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
50+
// Set the clear color to darkish green.
51+
gl.clearColor(0.0, 0.5, 0.0, 1.0);
52+
// Clear the context with the newly set color. This is
53+
// the function call that actually does the drawing.
54+
gl.clear(gl.COLOR_BUFFER_BIT);
55+
canvas.flush(); // must be called to draw on screen
5556
}
5657
```
5758

5859
## API
5960

60-
- 2D Similar to -> the [Web Spec](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D)
61-
- WebGL Similar to -> the [Web Spec](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext)
62-
- WebGL2 Similar to -> the [Web Spec](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext)
63-
61+
- 2D Similar to -> the [Web Spec](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D)
62+
- WebGL Similar to -> the [Web Spec](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext)
63+
- WebGL2 Similar to -> the [Web Spec](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
21
.DS_Store
32
CanvasDemo/Pods

packages/canvas/src-native/canvas-ios/CanvasDemo/CanvasDemo.xcodeproj/project.pbxproj

Lines changed: 29 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 51;
6+
objectVersion = 52;
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
4297E6E7EE343316CB1780AF /* Pods_CanvasDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5BC09618707C0A8402336FA /* Pods_CanvasDemo.framework */; };
1110
F16241E822DA6E9C007FBF7B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F16241E722DA6E9C007FBF7B /* AppDelegate.swift */; };
1211
F16241EA22DA6E9C007FBF7B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F16241E922DA6E9C007FBF7B /* ViewController.swift */; };
1312
F16241ED22DA6E9C007FBF7B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F16241EB22DA6E9C007FBF7B /* Main.storyboard */; };
1413
F16241EF22DA6E9D007FBF7B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F16241EE22DA6E9D007FBF7B /* Assets.xcassets */; };
1514
F16241F222DA6E9D007FBF7B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F16241F022DA6E9D007FBF7B /* LaunchScreen.storyboard */; };
1615
F16241FD22DA6E9D007FBF7B /* CanvasDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F16241FC22DA6E9D007FBF7B /* CanvasDemoTests.swift */; };
1716
F162420822DA6E9D007FBF7B /* CanvasDemoUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F162420722DA6E9D007FBF7B /* CanvasDemoUITests.swift */; };
17+
F1FF6B07252535C8001DAE0D /* CanvasNative.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1FF6B06252535C8001DAE0D /* CanvasNative.xcframework */; };
18+
F1FF6B08252535C8001DAE0D /* CanvasNative.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F1FF6B06252535C8001DAE0D /* CanvasNative.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1819
/* End PBXBuildFile section */
1920

2021
/* Begin PBXContainerItemProxy section */
@@ -34,9 +35,21 @@
3435
};
3536
/* End PBXContainerItemProxy section */
3637

38+
/* Begin PBXCopyFilesBuildPhase section */
39+
F1FF6B09252535C8001DAE0D /* Embed Frameworks */ = {
40+
isa = PBXCopyFilesBuildPhase;
41+
buildActionMask = 2147483647;
42+
dstPath = "";
43+
dstSubfolderSpec = 10;
44+
files = (
45+
F1FF6B08252535C8001DAE0D /* CanvasNative.xcframework in Embed Frameworks */,
46+
);
47+
name = "Embed Frameworks";
48+
runOnlyForDeploymentPostprocessing = 0;
49+
};
50+
/* End PBXCopyFilesBuildPhase section */
51+
3752
/* Begin PBXFileReference section */
38-
11EDA523E9C10AF3795C1D1C /* Pods-CanvasDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CanvasDemo.release.xcconfig"; path = "Target Support Files/Pods-CanvasDemo/Pods-CanvasDemo.release.xcconfig"; sourceTree = "<group>"; };
39-
C5BC09618707C0A8402336FA /* Pods_CanvasDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CanvasDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4053
F16241E422DA6E9C007FBF7B /* CanvasDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CanvasDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
4154
F16241E722DA6E9C007FBF7B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
4255
F16241E922DA6E9C007FBF7B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
@@ -50,17 +63,15 @@
5063
F162420322DA6E9D007FBF7B /* CanvasDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CanvasDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5164
F162420722DA6E9D007FBF7B /* CanvasDemoUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CanvasDemoUITests.swift; sourceTree = "<group>"; };
5265
F162420922DA6E9D007FBF7B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
53-
F198A1462514884300DFCA5D /* CanvasNative.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CanvasNative.framework; sourceTree = BUILT_PRODUCTS_DIR; };
54-
F1A0AEE425147B5A0069F286 /* CanvasNative.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CanvasNative.framework; sourceTree = BUILT_PRODUCTS_DIR; };
55-
F6CBFBDC7F089D70DB46979A /* Pods-CanvasDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CanvasDemo.debug.xcconfig"; path = "Target Support Files/Pods-CanvasDemo/Pods-CanvasDemo.debug.xcconfig"; sourceTree = "<group>"; };
66+
F1FF6B06252535C8001DAE0D /* CanvasNative.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = CanvasNative.xcframework; path = ../CanvasNative/Dist/CanvasNative.xcframework; sourceTree = "<group>"; };
5667
/* End PBXFileReference section */
5768

5869
/* Begin PBXFrameworksBuildPhase section */
5970
F16241E122DA6E9C007FBF7B /* Frameworks */ = {
6071
isa = PBXFrameworksBuildPhase;
6172
buildActionMask = 2147483647;
6273
files = (
63-
4297E6E7EE343316CB1780AF /* Pods_CanvasDemo.framework in Frameworks */,
74+
F1FF6B07252535C8001DAE0D /* CanvasNative.xcframework in Frameworks */,
6475
);
6576
runOnlyForDeploymentPostprocessing = 0;
6677
};
@@ -84,18 +95,14 @@
8495
4481D334EC20564EAB46B0E3 /* Frameworks */ = {
8596
isa = PBXGroup;
8697
children = (
87-
F198A1462514884300DFCA5D /* CanvasNative.framework */,
88-
F1A0AEE425147B5A0069F286 /* CanvasNative.framework */,
89-
C5BC09618707C0A8402336FA /* Pods_CanvasDemo.framework */,
98+
F1FF6B06252535C8001DAE0D /* CanvasNative.xcframework */,
9099
);
91100
name = Frameworks;
92101
sourceTree = "<group>";
93102
};
94103
783CB0E45C2971C4BD79D204 /* Pods */ = {
95104
isa = PBXGroup;
96105
children = (
97-
F6CBFBDC7F089D70DB46979A /* Pods-CanvasDemo.debug.xcconfig */,
98-
11EDA523E9C10AF3795C1D1C /* Pods-CanvasDemo.release.xcconfig */,
99106
);
100107
path = Pods;
101108
sourceTree = "<group>";
@@ -160,11 +167,10 @@
160167
isa = PBXNativeTarget;
161168
buildConfigurationList = F162420C22DA6E9D007FBF7B /* Build configuration list for PBXNativeTarget "CanvasDemo" */;
162169
buildPhases = (
163-
EA48906440EC6E1223D3A2B6 /* [CP] Check Pods Manifest.lock */,
164170
F16241E022DA6E9C007FBF7B /* Sources */,
165171
F16241E122DA6E9C007FBF7B /* Frameworks */,
166172
F16241E222DA6E9C007FBF7B /* Resources */,
167-
C3CC4E5E3AD28EF0955BCF3B /* [CP] Embed Pods Frameworks */,
173+
F1FF6B09252535C8001DAE0D /* Embed Frameworks */,
168174
);
169175
buildRules = (
170176
);
@@ -281,48 +287,6 @@
281287
};
282288
/* End PBXResourcesBuildPhase section */
283289

284-
/* Begin PBXShellScriptBuildPhase section */
285-
C3CC4E5E3AD28EF0955BCF3B /* [CP] Embed Pods Frameworks */ = {
286-
isa = PBXShellScriptBuildPhase;
287-
buildActionMask = 2147483647;
288-
files = (
289-
);
290-
inputFileListPaths = (
291-
"${PODS_ROOT}/Target Support Files/Pods-CanvasDemo/Pods-CanvasDemo-frameworks-${CONFIGURATION}-input-files.xcfilelist",
292-
);
293-
name = "[CP] Embed Pods Frameworks";
294-
outputFileListPaths = (
295-
"${PODS_ROOT}/Target Support Files/Pods-CanvasDemo/Pods-CanvasDemo-frameworks-${CONFIGURATION}-output-files.xcfilelist",
296-
);
297-
runOnlyForDeploymentPostprocessing = 0;
298-
shellPath = /bin/sh;
299-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CanvasDemo/Pods-CanvasDemo-frameworks.sh\"\n";
300-
showEnvVarsInLog = 0;
301-
};
302-
EA48906440EC6E1223D3A2B6 /* [CP] Check Pods Manifest.lock */ = {
303-
isa = PBXShellScriptBuildPhase;
304-
buildActionMask = 2147483647;
305-
files = (
306-
);
307-
inputFileListPaths = (
308-
);
309-
inputPaths = (
310-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
311-
"${PODS_ROOT}/Manifest.lock",
312-
);
313-
name = "[CP] Check Pods Manifest.lock";
314-
outputFileListPaths = (
315-
);
316-
outputPaths = (
317-
"$(DERIVED_FILE_DIR)/Pods-CanvasDemo-checkManifestLockResult.txt",
318-
);
319-
runOnlyForDeploymentPostprocessing = 0;
320-
shellPath = /bin/sh;
321-
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
322-
showEnvVarsInLog = 0;
323-
};
324-
/* End PBXShellScriptBuildPhase section */
325-
326290
/* Begin PBXSourcesBuildPhase section */
327291
F16241E022DA6E9C007FBF7B /* Sources */ = {
328292
isa = PBXSourcesBuildPhase;
@@ -504,21 +468,21 @@
504468
};
505469
F162420D22DA6E9D007FBF7B /* Debug */ = {
506470
isa = XCBuildConfiguration;
507-
baseConfigurationReference = F6CBFBDC7F089D70DB46979A /* Pods-CanvasDemo.debug.xcconfig */;
508471
buildSettings = {
509472
ALWAYS_SEARCH_USER_PATHS = NO;
510473
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
474+
BUILD_LIBRARY_FOR_DISTRIBUTION = NO;
511475
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
512476
CODE_SIGN_STYLE = Automatic;
513477
DEVELOPMENT_TEAM = TG7LSJHB64;
514-
ENABLE_BITCODE = NO;
478+
ENABLE_BITCODE = YES;
515479
FRAMEWORK_SEARCH_PATHS = (
516480
"$(inherited)",
517-
"$(PROJECT_DIR)",
481+
"\"$(SRCROOT)/../CanvasNative/Dist\"",
518482
);
519483
HEADER_SEARCH_PATHS = "$(inherited)";
520484
INFOPLIST_FILE = CanvasDemo/Info.plist;
521-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
485+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
522486
LD_RUNPATH_SEARCH_PATHS = (
523487
"$(inherited)",
524488
"@executable_path/Frameworks",
@@ -539,21 +503,21 @@
539503
};
540504
F162420E22DA6E9D007FBF7B /* Release */ = {
541505
isa = XCBuildConfiguration;
542-
baseConfigurationReference = 11EDA523E9C10AF3795C1D1C /* Pods-CanvasDemo.release.xcconfig */;
543506
buildSettings = {
544507
ALWAYS_SEARCH_USER_PATHS = NO;
545508
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
509+
BUILD_LIBRARY_FOR_DISTRIBUTION = NO;
546510
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
547511
CODE_SIGN_STYLE = Automatic;
548512
DEVELOPMENT_TEAM = TG7LSJHB64;
549-
ENABLE_BITCODE = NO;
513+
ENABLE_BITCODE = YES;
550514
FRAMEWORK_SEARCH_PATHS = (
551515
"$(inherited)",
552-
"$(PROJECT_DIR)",
516+
"\"$(SRCROOT)/../CanvasNative/Dist\"",
553517
);
554518
HEADER_SEARCH_PATHS = "$(inherited)";
555519
INFOPLIST_FILE = CanvasDemo/Info.plist;
556-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
520+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
557521
LD_RUNPATH_SEARCH_PATHS = (
558522
"$(inherited)",
559523
"@executable_path/Frameworks",

packages/canvas/src-native/canvas-ios/CanvasDemo/CanvasDemo.xcodeproj/xcshareddata/xcschemes/CanvasDemo.xcscheme

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
</Testables>
5252
</TestAction>
5353
<LaunchAction
54-
buildConfiguration = "Debug"
55-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
54+
buildConfiguration = "Release"
55+
selectedDebuggerIdentifier = ""
56+
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
5757
launchStyle = "0"
5858
useCustomWorkingDirectory = "NO"
5959
ignoresPersistentStateOnLaunch = "NO"

0 commit comments

Comments
 (0)