SwiftUIcon
SwiftUIcon copied to clipboard
Add 'platforms' to Package.swift
By doing this, Xcode won't complain about not being able to import SwiftUI in release builds.
Since this framework will be run from a SwiftUI-compatible target anyways, this should not be a problem for people using it in projects with lower version requirements... (I think).
@kevinrpb Thank you for this! How was this issue manifesting for you and how do you reproduce? If you can let me know how to reproduce, I can get this reviewed and merged soon 👍
@kevinrpb Thank you for this! How was this issue manifesting for you and how do you reproduce? If you can let me know how to reproduce, I can get this reviewed and merged soon 👍
Sure! If you add the package to eg. a SwiftUI project and try to archive, when Xcode builds the project for "Any iOS device", it will complain and throw errors in SwiftUIcon stating "Cannot find <Class/Struct> in scope" for SwiftUI View
s and other elements.
My understanding is that this happens because Xcode tries to build the package for all architectures and since some of them (armv7) don't support SwiftUI, it throws errors. So setting the minimum platform version prevents Xcode from trying to build on unsupported archs.
You can see something similar happening in this thread, where the suggestion is to use compiler #if
conditional to the architecture. I don't think that's appropriate in this case since SwiftUicon will be compiled from a SwiftUI-compatible target anyways (ie. with a supported arch and version), so setting the platforms
property solves the issue.
Let me know if something is not clear and I'll try and make a demo project or a video or something 😄