SnapKit / Masonry

Harness the power of AutoLayout NSLayoutConstraints with a simplified, chainable and expressive syntax. Supports iOS and OSX Auto Layout
MIT License
18.06k stars 3.15k forks source link

Add support for Swift Package Manager #600

Open fredericgermain opened 2 years ago

fredericgermain commented 2 years ago

git@github.com:fredericgermain/Masonry.git can be added to a project using branch pr/swiftpm

It would be nice to have swiftpm added in a new version

Inspired by https://stackoverflow.com/a/67376388/1532175, I'm not a Package.swift pro

Wei18 commented 1 year ago

Could you only add folder include and Package.swift?

Thanks

fredericgermain commented 1 year ago

Do you mean removing the commit that removed the Pods file? Why would you want to keep them?

For me, they shouldn't be in the source base as you can get them with a simple pod install. They are even more useless if you use swiftpm, they would pollute the project view in XCode I think.

Wei18 commented 1 year ago

I'm doing the same for needed-maintenance to Pod -> Package too.

Why would you want to keep them?

I think you need support both Cocoapods and SwiftPackage until the author decide to nonsupport Cocoapods.

Thing like this, https://github.com/AssistoLab/KVNProgress/pull/126 https://github.com/m1entus/INSPullToRefresh/pull/93

fredericgermain commented 1 year ago

Oh. I don't remove CocoaPods support with my commits: Masonry.spec, Podfile, Podfile.lock are still there.

I remove all files that are added by the pod install command itself. These files are completely unnecessary when you use Masonry as a CocaoPods dependency, and they pollute swiftpm projects.

They should never have been in the git repository in the first place. In the projects you've just linked, there are ...spec, Podfile and Podfile.lock, but without the Pods/ directory.

So for me, everything is fine, unless someone actually has a use case for not removing these files.

Wei18 commented 1 year ago

Thanks for explanation.

For someone wanna quick use this solution. (I have tried successful at least).

And added following if needed. // Apple Clang - Preprocessing (1) // [Note] MASSHORTHAND: define this constant if you want to use Masonry without the 'mas' prefix // [Note] MAS_SHORTHAND_GLOBALS: define this constant if you want to enable auto-boxing for default syntax GCC_PREPROCESSOR_DEFINITIONS = MAS_SHORTHAND MAS_SHORTHAND_GLOBALS $(inherited)