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

Add support for CocoaPods #12

Merged
merged 5 commits into from
May 20, 2020
Merged

Conversation

ricsantos
Copy link
Collaborator

🖤

As per your blog post, I have made a PR that adds support for CocoaPods.

Describe your changes

Added a .podspec file. It has an iOS deployment target added, but this is to ensure CocoaPods adds the source to your project. In order to make it compile for iOS, I wrapped most of the code in main.swift with a platform check #if os(OSX). I also chose Swift 5.0 instead of 5.2, hope that's ok.

The readme was updated with CocoaPods instructions. The pod install instruction won't work until the pod is actually published to trunk.

For testing, I use the following:

pod 'Nine41', :git => 'https://github.com/ricsantos/Nine41.git', :branch => 'cocoapods'

as I found that the source wasn't copied in using the :path => directive (not sure if I did something wrong here).

The build script phase is similar to the SPM one:

/usr/bin/xcrun --sdk macosx swift "${PODS_ROOT}/Nine41/Sources/main.swift"

Note I used swift ... main.swift instead of swift run ... main.swift as the former is deprecated.

On first launch the simulator status bar seems not to update, but it does on subsequent launches.

The timezone is incorrect as per #10

@jessesquires jessesquires added the enhancement New feature or request label May 20, 2020
@jessesquires jessesquires added this to the 2.1.0 milestone May 20, 2020
@jessesquires
Copy link
Owner

thanks so much @ricsantos ! 🙌

@jessesquires
Copy link
Owner

Added a .podspec file. It has an iOS deployment target added, but this is to ensure CocoaPods adds the source to your project. In order to make it compile for iOS, I wrapped most of the code in main.swift with a platform check #if os(OSX).

Looks good 👌 Actually, let's just wrap the whole thing in #if os(OSX).

I also chose Swift 5.0 instead of 5.2, hope that's ok.

Pushed an update to the .podspec to clean it up and made this 5.2 instead. Since Swift/Xcode has good support for using multiple swift version, we might as well claim the latest. 😄

The readme was updated with CocoaPods instructions.

Thank you! 💯

The pod install instruction won't work until the pod is actually published to trunk.

Yep, I'll take care of that. 👌

Note I used swift ... main.swift instead of swift run ... main.swift as the former is deprecated.

Where is this documented? I tried this locally with Xcode 11.4.1 and I still needed run

On first launch the simulator status bar seems not to update, but it does on subsequent launches.

This is expected, so no worries.

The timezone is incorrect as per #10

Just merged a fix for this!

@ricsantos
Copy link
Collaborator Author

Where is this documented? I tried this locally with Xcode 11.4.1 and I still needed run

When I tested the script in the console. Also using Xcode 11.4.1

$ /usr/bin/xcrun --sdk macosx swift run "Pods/Nine41/Sources/main.swift"
warning: 'swift run file.swift' command to interpret swift files is deprecated; use 'swift file.swift' instead
Fixing status bars...
✅ iPhone 8, B1257458-683D-4480-976A-CB31FC14D567
✅ iPhone SE (2nd generation), 96503654-AEAC-4ED2-BEE7-1FF27A9E58FE

(xcrun version 50.)

@jessesquires
Copy link
Owner

@ricsantos ah, I was literally just testing this. 😄

Yes -- it looks like this only applies to swift FILE commands, but for packages run is still required

@jessesquires jessesquires merged commit aaa761d into jessesquires:master May 20, 2020
@jessesquires
Copy link
Owner

i'll tag the new release + push to cocoapods soon

@jessesquires
Copy link
Owner

thanks again for contributing @ricsantos! 🥇

sent you an invite to be a collaborator

@ricsantos
Copy link
Collaborator Author

No worries, thanks for creating the project! So good to have the status bar set automatically!

@jessesquires
Copy link
Owner

just realized i messed up the podspec here with my edits 😬

fixed in #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants