From f0c7ba4e66d3dc8135ccf9146afc05f9dff3c4ff Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki Date: Wed, 22 Dec 2021 14:19:30 +0100 Subject: [PATCH] Initial iOS platform support Make the library compile on iOS --- Package.swift | 3 ++- Sources/AppIconCreator/IconImage.swift | 2 ++ Sources/AppIconCreator/IconPreview.swift | 2 ++ Sources/AppIconCreator/IconPreviews.swift | 2 ++ Sources/AppIconCreator/IconView.swift | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 093e24f..a5c97a0 100644 --- a/Package.swift +++ b/Package.swift @@ -5,7 +5,8 @@ import PackageDescription let package = Package( name: "swiftui-app-icon-creator", platforms: [ - .macOS(.v11) + .macOS(.v11), + .iOS(.v13), ], products: [ .library( diff --git a/Sources/AppIconCreator/IconImage.swift b/Sources/AppIconCreator/IconImage.swift index 4a86a13..1d4adf4 100644 --- a/Sources/AppIconCreator/IconImage.swift +++ b/Sources/AppIconCreator/IconImage.swift @@ -1,3 +1,4 @@ +#if os(macOS) import SwiftUI public struct IconImage { @@ -98,3 +99,4 @@ extension NSImage { return imageRep.representation(using: .png, properties: [.compressionFactor: 1])! } } +#endif diff --git a/Sources/AppIconCreator/IconPreview.swift b/Sources/AppIconCreator/IconPreview.swift index 9bf2a1b..b7e7c5b 100644 --- a/Sources/AppIconCreator/IconPreview.swift +++ b/Sources/AppIconCreator/IconPreview.swift @@ -1,3 +1,4 @@ +#if os(macOS) import SwiftUI public struct IconPreview: View { @@ -41,3 +42,4 @@ public struct IconPreview: View { } } } +#endif diff --git a/Sources/AppIconCreator/IconPreviews.swift b/Sources/AppIconCreator/IconPreviews.swift index dd447f6..422bacd 100644 --- a/Sources/AppIconCreator/IconPreviews.swift +++ b/Sources/AppIconCreator/IconPreviews.swift @@ -1,3 +1,4 @@ +#if os(macOS) import SwiftUI public struct IconPreviews: View { @@ -20,3 +21,4 @@ public struct IconPreviews: View { .fixedSize() } } +#endif diff --git a/Sources/AppIconCreator/IconView.swift b/Sources/AppIconCreator/IconView.swift index a68defb..f4b021a 100644 --- a/Sources/AppIconCreator/IconView.swift +++ b/Sources/AppIconCreator/IconView.swift @@ -14,9 +14,11 @@ public struct IconView: View, Equatable { struct IconView_Preivews: PreviewProvider { static var previews: some View { + #if os(macOS) IconPreviews( icon: IconView(), configs: .iOS ) + #endif } }