zenangst / Blueprints

:cyclone: Blueprints - A framework that is meant to make your life easier when working with collection view flow layouts.
Other
991 stars 56 forks source link

Swift Package Manager support for iOS #141

Closed Legoless closed 4 years ago

Legoless commented 4 years ago

This PR adds the ability to installs Blueprints as a Swift Package on iOS/tvOS. Due to project structure macOS is not yet supported.

zenangst commented 4 years ago

@Legoless what changes do we need to include in order to support macOS?

Legoless commented 4 years ago

@zenangst SPM cannot separately have files per platform, so all files are included for the project. You would have to add conditional imports to all Mac/iOS files that aren't shared. For example:

#if canImport(UIKit)
... iOS/tvOS code...
#endif

And in macOS only files:

#if canImport(AppKit)
... macOS only code ...
#endif

For the case above, I only included iOS/tvOS section and macOS files aren't in there. If I add them, it will no longer compile on either platform. :) And once you have Package.swift in repo, you also need to create a new version on Github, otherwise it will not load in Xcode.