Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

example: updates for XCFramework and Mac Catalyst #72

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ last-change
*.apk
*.app
*.framework
*.xcframework
*.aar
*.iml
.idea
.gradle

# Xcode configuration files.
*.xcworkspace
xcuserdata
*.entitlements

# Android Studio build and IDE configuration files.
example/bind/android/local.properties
example/bind/android/gradlew*
Expand Down
9 changes: 4 additions & 5 deletions example/bind/ios/README
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
1. Use gomobile bind to bind the golang.org/x/mobile/example/bind/hello package.
The following command will create a static framework bundle in the current
directory.
The following command will create an XCFramework in the current directory.

$ gomobile bind -target=ios golang.org/x/mobile/example/bind/hello

2. Open the Xcode project by double clicking on bind.xcodeproj.
The project will not build - ViewController.m calls a function from the hello
package so requires the hello.framework the gomobild bind command created
package so requires the Hello.xcframework that gomobile bind command created
in Step 1.

3. Drag-and-drop the hello.framework from the desktop to the project navigation window.
This will automatically include the hello framework into the project.
3. Drag-and-drop Hello.xcframework from the desktop to the project navigation window.
This will automatically include the Hello.xcframework into the project.

4. Build.
10 changes: 5 additions & 5 deletions example/ivy/ios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

This directory contains the source code to the Ivy iOS app.

To build, first create the mobile.framework out of the Go
To build, first create the Mobile.xcframework out of the Go
implementation of Ivy. Run:

```
go install golang.org/x/mobile/cmd/gomobile@latest
go install golang.org/x/mobile/cmd/gomobile@latest
go install golang.org/x/mobile/cmd/gobind@latest
```

Expand All @@ -17,11 +17,11 @@ mkdir work; cd work
go mod init work
go get -d golang.org/x/mobile/bind@latest
go get -d robpike.io/ivy/mobile
gomobile bind -target=ios robpike.io/ivy/mobile
gomobile bind -target=ios,iossimulator,maccatalyst,macos robpike.io/ivy/mobile
```

Place the mobile.framework directory in this directory, and
Place the Mobile.xcframework directory in this directory, and
then open ivy.xcodeproj in Xcode.

You have to specify Development Team for code signing certificate in:
Project Settings -> Targets -> Signing & Capabilities -> Signing -> Team.
Project Settings -> Targets -> Signing & Capabilities -> Signing -> Team.
20 changes: 12 additions & 8 deletions example/ivy/ios/ivy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/* Begin PBXBuildFile section */
7DC2F7EA26DFD9870026EBED /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DC2F7E826DFCF750026EBED /* WebKit.framework */; };
7DC2F7ED26DFD9890026EBED /* mobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4C2833A1B98889100878964 /* mobile.framework */; };
7DC2F7ED26DFD9890026EBED /* Mobile.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4C2833A1B98889100878964 /* Mobile.xcframework */; };
B461D25D1B31B27700EC4870 /* tape.html in Resources */ = {isa = PBXBuildFile; fileRef = B461D25C1B31B27700EC4870 /* tape.html */; };
B48878331B2E714100C7CC3C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B488780C1B2D1C3F00C7CC3C /* AppDelegate.m */; };
B48878341B2E714100C7CC3C /* IvyController.m in Sources */ = {isa = PBXBuildFile; fileRef = B488780F1B2D1C3F00C7CC3C /* IvyController.m */; };
Expand All @@ -35,15 +35,15 @@
B48878311B2DF1B200C7CC3C /* Suggestion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Suggestion.m; sourceTree = "<group>"; };
B488783B1B2F9CD500C7CC3C /* DocsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocsController.h; sourceTree = "<group>"; };
B488783C1B2F9CD500C7CC3C /* DocsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DocsController.m; sourceTree = "<group>"; };
B4C2833A1B98889100878964 /* mobile.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = mobile.framework; sourceTree = "<group>"; };
B4C2833A1B98889100878964 /* Mobile.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = Mobile.xcframework; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
B48878011B2D1C3F00C7CC3C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7DC2F7ED26DFD9890026EBED /* mobile.framework in Frameworks */,
7DC2F7ED26DFD9890026EBED /* Mobile.xcframework in Frameworks */,
7DC2F7EA26DFD9870026EBED /* WebKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -62,7 +62,7 @@
B48877FB1B2D1C3F00C7CC3C = {
isa = PBXGroup;
children = (
B4C2833A1B98889100878964 /* mobile.framework */,
B4C2833A1B98889100878964 /* Mobile.xcframework */,
B48878061B2D1C3F00C7CC3C /* ivy */,
B48878051B2D1C3F00C7CC3C /* Products */,
7DC2F7E726DFCF740026EBED /* Frameworks */,
Expand Down Expand Up @@ -248,6 +248,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = "arm64 x86_64 armv7";
};
Expand Down Expand Up @@ -296,6 +297,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VALID_ARCHS = "arm64 x86_64 armv7";
Expand All @@ -322,8 +324,9 @@
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = ivy;
STRIP_STYLE = debugging;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = "arm64 armv7";
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = "1,2,6";
VALID_ARCHS = "arm64 x86_64 armv7";
};
name = Debug;
};
Expand All @@ -348,8 +351,9 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.google.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ivy;
STRIP_STYLE = debugging;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = "arm64 armv7";
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = "1,2,6";
VALID_ARCHS = "arm64 x86_64 armv7";
};
name = Release;
};
Expand Down