Compare commits

...

3 commits
0.8.0 ... main

Author SHA1 Message Date
Shibo Lyu
9a8b486f55
Create FUNDING.yml 2024-12-24 14:18:08 +08:00
Shibo Lyu
481f59cf41 fix: macos build
fixes #4
2024-12-20 14:58:23 +08:00
Shibo Lyu
7042102108 fix: build on non-macOS. 2024-12-18 16:49:24 +08:00
4 changed files with 11 additions and 2 deletions

2
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,2 @@
github: [laosb]
buy_me_a_coffee: laosb

View file

@ -233,7 +233,7 @@ public struct CropImageView<Controls: View, CutHole: View>: View {
var body: some View {
VStack {
CropImageView(
image: .init(contentsOf: URL(string: "file:///System/Library/Desktop%20Pictures/Hello%20Metallic%20Blue.heic")!)!,
image: .previewImage,
targetSize: targetSize
) {
result = $0

View file

@ -13,10 +13,17 @@ import AppKit
///
/// On macOS, it's `NSImage` and on iOS/visionOS it's `UIImage`.
public typealias PlatformImage = NSImage
extension PlatformImage {
@MainActor static let previewImage: PlatformImage = .init(contentsOf: URL(string: "file:///System/Library/Desktop%20Pictures/Hello%20Metallic%20Blue.heic")!)!
}
#else
import UIKit
/// The image object type, aliased to each platform.
///
/// On macOS, it's `NSImage` and on iOS/visionOS it's `UIImage`.
public typealias PlatformImage = UIImage
extension PlatformImage {
// This doesn't really work, but at least passes build.
static let previewImage: PlatformImage = .init(contentsOfFile: "/System/Library/Desktop Pictures/Hello Metallic Blue.heic")!
}
#endif

View file

@ -202,7 +202,7 @@ struct UnderlyingImageView: View {
offset: $offset,
scale: $scale,
rotation: $rotation,
image: .init(contentsOf: URL(string: "file:///System/Library/Desktop%20Pictures/Hello%20Metallic%20Blue.heic")!)!,
image: .previewImage,
viewSize: .init(width: 200, height: 100),
targetSize: .init(width: 100, height: 100),
fulfillTargetFrame: true