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 Swift Package Manager #85

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mattprowse
Copy link
Contributor

See inline comments for explanations of some of the less obvious changes.

I tried getting this to work without having to move the resources into their own folder, but the Package.swift exclude list doesn't seem to apply to resources and and I got SPM errors that I couldn't work out how to resolve any other way.

SPM is also very particular about how the public headers are provided. I used an approach I've seen used in other Mac libraries which was to create a dedicated includes folder for SPM which contains symlinks to the relevant headers in their original locations.

I also added instructions to the README (and while I was there I added instructions for CocoaPods and Carthage too.

}

s.source_files = '*.{h,m}'
s.exclude_files = 'main.m', 'LetsMoveAppDelegate.{h,m}'
s.public_header_files = 'PFMoveApplication.h'

s.resources = '*.lproj'
s.resources = 'Resources/*.lproj'
Copy link
Contributor Author

@mattprowse mattprowse Jun 7, 2022

Choose a reason for hiding this comment

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

Update the Podfile to account for the relocated resources and to bump the version number.

@@ -7,4 +7,4 @@
// The contents of this file are dedicated to the public domain.

#import <Cocoa/Cocoa.h>
#import <LetsMove/PFMoveApplication.h>
#import "PFMoveApplication.h"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to make this a local #import to keep SPM happy.

Comment on lines +21 to +23
#ifdef SWIFT_PACKAGE
return SWIFTPM_MODULE_BUNDLE;
#else
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ensure the resources can be located when building with SPM.

name: "LetMove",
defaultLocalization: "en",
platforms: [
.macOS(.v10_10),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the lowest macOS version that can be specified in Package.swift.

.process("Resources")
],
publicHeadersPath: "include",
cSettings: [.unsafeFlags(["-fno-objc-arc"])]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Disable ARC.

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

Successfully merging this pull request may close these issues.

None yet

1 participant