Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Swift iphone app template #1870

Merged
merged 16 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 10 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
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/e2e/p1/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Commands:
wasm [options] <language> <name> Create a Polywrap wasm wrapper. langs:
assemblyscript, rust, golang, interface
app [options] <language> <name> Create a Polywrap application. langs:
typescript
typescript, ios
plugin [options] <language> <name> Create a Polywrap plugin. langs:
typescript, rust, python
template [options] <url> <name> Download template from a URL. formats:
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const urlStr = intlMsg.commands_create_options_t_url();

export const supportedLangs = {
wasm: ["assemblyscript", "rust", "golang", "interface"] as const,
app: ["typescript"] as const,
app: ["typescript", "ios"] as const,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should here be swift and not ios? btw idk why swift is not added in the plugin array below this line 🤔 we have support for plugins

Copy link
Contributor Author

@krisbitney krisbitney Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it "ios" and "android" for swift and Kotlin for clarity.

Swift is used for iOS, macOS, watchOS, and tvOS and I'm not sure what else.

Kotlin is used for Android, desktop, web back ends, multiplatform mobile apps, and more.

Do you think it makes more sense to do "swift" and "kotlin"? Maybe iOS and Android use cases are implied?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I lean toward the android/ios since the template specifically targets those. If it was a generic template then the language name would make more sense

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what you're saying make sense, but swift client supports iOS and macOS.

it still makes more sense to me to name this swift and kotlin rather than ios or android; this is codegen and from my perspective it should be agnostic of the OS (even tho I completely understand your point)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they're android/ios specific templates then IMO this should be "ios".
But, correct me if I'm wrong, it doesn't seem that is the case: https://github.com/polywrap/wrap-abi-bindgen/pull/55/files#diff-2539b6e33504cb7efe01bdb09121a3aaba4ba6023d13c460f34dcb161ca244de

Also, whatever we do, we should be consistent. In this thread there's a push for "ios" while in that link it's "app-swift"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codegen bindings are not specific to ios, but the app template is a simple ios app

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS and Android are platforms, not languages. It's a bit weird to have "iOS, Golang, Android, Typescript, Interface"; as it seems there are 3, or at least 2, concepts mixed in there.

That said, the template you're talking about targets "iOS" in particular. If it was generic enough to be built to macOS or tvOS, then it should be swift; but it isn't. I think here the answer should be "ios"; but indeed a bit weird to have "ios" as a "supportedLang". Maybe it's just a variable naming change thing, but nvm.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This situation is VERY similar to when we had a "react" app template. So, based on how we handled that, I suggest we:

  1. Merge these android & ios templates now so they can be used
  2. Create new app templates that are "vanilla" kotlin & swift
  3. Move ios & android templates to their own repos

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also one detail to make sure we're all clear on: "android" and "ios" are ONLY used within the polywrap create command. All other places (codegen, manifest, etc) "kotlin" and "swift" are used.

plugin: ["typescript", "rust", "python"] as const,
};

Expand Down
47 changes: 47 additions & 0 deletions packages/templates/app/ios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Polywrap
wrap

# AppCode
.idea/
.idea_modules/

# User-specific
*.iml

# Xcode
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
*.moved-aside

# Compiled Source
*.pyc
*.o
*.out

# Project Files
*.xcworkspace

# CocoaPods
Pods/

# Carthage
Carthage/Build

# Swift Package Manager
.build/

# macOS
.DS_Store
.AppleDouble
.LSOverride

# Unix
*.swp
*~
20 changes: 20 additions & 0 deletions packages/templates/app/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'Template' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

# Pods for Template
pod 'PolywrapClient', '0.0.8'

target 'TemplateTests' do
inherit! :search_paths
# Pods for testing
end

target 'TemplateUITests' do
# Pods for testing
end

end
32 changes: 32 additions & 0 deletions packages/templates/app/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
PODS:
- AsyncObjects (2.1.0):
- OrderedCollections (~> 1.0.0)
- MessagePacker (0.4.7)
- OrderedCollections (1.0.4)
- PolywrapClient (0.0.8):
- AsyncObjects (~> 2.1.0)
- MessagePacker (~> 0.4.7)
- PolywrapClientNative (~> 0.0.7)
- PolywrapClientNative (0.0.7)

DEPENDENCIES:
- PolywrapClient (= 0.0.8)

SPEC REPOS:
trunk:
- AsyncObjects
- MessagePacker
- OrderedCollections
- PolywrapClient
- PolywrapClientNative

SPEC CHECKSUMS:
AsyncObjects: 37d04187100fd9cd545a6570a8ad727c5a3c5090
MessagePacker: ab2fe250e86ea7aedd1a9ee47a37083edd41fd02
OrderedCollections: c754ce5f9e42cf22b73afd73582317347903ab6d
PolywrapClient: c8f2edac2500bbc421dfe7d2c4af757fa6db7224
PolywrapClientNative: 30398b076b00c8bbf5c2046cfa1c1554c3c31321

PODFILE CHECKSUM: 90587966da0d18a791d29e2a8d3181c36468506e

COCOAPODS: 1.12.1
Loading
Loading