-
Notifications
You must be signed in to change notification settings - Fork 7
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 macOS and watchOS support to Package.swift #1
Conversation
Hi @jflan-dd, What do you think about this PR ? |
@@ -11,9 +11,11 @@ | |||
// or implied. See the License for the specific language governing permissions and limitations under | |||
// the License. | |||
|
|||
#if canImport(UIKit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really hope watchOS support gets approved. Should this if import just wrap the UIKit import and why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because UIImage is used and UIKit import is missing.
Hey @mackoj! Thanks for the contribution! Sorry I missed the notification on this PR. I'll take a look at it today. |
The |
So let's remove watchOS for the moment I'll update the PR tomorrow. |
@mackoj I think putting all of the Maybe we should update the various public func assertSnapshots<Format>(
as snapshotting: Snapshotting<AnyView, Format>,
record recording: Bool = false,
file: StaticString = #file,
testName: String = #function,
line: UInt = #line
) {
// Unchanged...
} and #if canImport(UIKit)
import UIKit
extension PreviewSnapshots {
/// Doc comment
public func assertSnapshots(
record recording: Bool = false,
file: StaticString = #file,
testName: String = #function,
line: UInt = #line
) {
assertSnapshots(as: .image, record: recording, file: file, testName: testName, line: line)
}
}
// MARK: - PreviewSnapshots.assertSnapshots + modify
extension PreviewSnapshots {
/// Doc comment
public func assertSnapshots<Modified: View>(
record recording: Bool = false,
file: StaticString = #file,
testName: String = #function,
line: UInt = #line,
modify: (AnyView) -> Modified
) {
assertSnapshots(as: .image, record: recording, file: file, testName: testName, line: line, modify: modify)
}
}
#endif |
This is a better approach for sure my goal was merely to make it compile on macOS but having it working macOS is even better ? do you want to do it ? should I close my PR? |
#3 Is better than this PR so I close it |
Hi,
Thank you for creating this library, upon which I rely daily, along with my library EnvironmentVariationPreview, to enhance the testing coverage of my work.
To enable the usage of
swift package diagnose-api-breaking-changes
, I kindly request adding support formacOS
in thePackage.swift
file. Additionally, if feasible, it would be great to include support forwatchOS
as well.Thank you once again!
What does this PR modify:
Now,
swift package diagnose-api-breaking-changes main
seems to build the branch version, but it can't build themain
branch for macOS since it is not compatible or buildable.This PR don't change any logic of
swiftui-preview-snapshots
it just add a few@available
marker.Best regards,