From 2681164801da82998ca6cdaaaa11a2bf630058d6 Mon Sep 17 00:00:00 2001 From: Matt Maddux Date: Tue, 4 Feb 2020 10:57:37 -0600 Subject: [PATCH] Added macOS support --- Package.swift | 3 ++- README.md | 2 +- Sources/FASwiftUI/FAPicker.swift | 29 ++++------------------------- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/Package.swift b/Package.swift index 369ca0e..e99af46 100644 --- a/Package.swift +++ b/Package.swift @@ -6,7 +6,8 @@ import PackageDescription let package = Package( name: "FASwiftUI", platforms: [ - .iOS(.v13) + .iOS(.v13), + .macOS(.v10_15) ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/README.md b/README.md index 5fceb39..f5e9d04 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ struct ContentView: View { ![Regualr Icon Screenshot](https://raw.githubusercontent.com/mattmaddux/FASwiftUI/master/icon-red.png) -Have the user select an icon with an easy string binding +Have the user select an icon with an easy string binding (not available on macOS) ```swift import SwiftUI diff --git a/Sources/FASwiftUI/FAPicker.swift b/Sources/FASwiftUI/FAPicker.swift index 3365505..468df7e 100644 --- a/Sources/FASwiftUI/FAPicker.swift +++ b/Sources/FASwiftUI/FAPicker.swift @@ -9,6 +9,8 @@ import SwiftUI import QGrid +#if os(iOS) + struct FASearchBar: View { @Environment(\.colorScheme) var colorScheme: ColorScheme @@ -49,14 +51,6 @@ struct FAPickerCell: View { .frame(width: 55, height: 55) } } -// Button(action: { -// self.selected = self.icon -// }, label: { -// FAText(icon: icon, size: 35) -// .foregroundColor(colorScheme == .light ? Color.black : Color.white) -// .frame(width: 55, height: 55) -// }) -// .background(selected == icon ? (colorScheme == .light ? Color.black.opacity(0.2) : Color.white.opacity(0.2)) : Color.clear) .cornerRadius(5) } } @@ -85,8 +79,6 @@ public struct FAPicker: View { hSpacing: 10, vPadding: 10, hPadding: 10) { icon in -// Text("Hello") -// FAPickerCell(icon: icon, selected: self.$selected) FAPickerCell(icon: icon, action: { self.selected = icon.id self.showing = false @@ -107,22 +99,9 @@ public struct FAPicker: View { } } .navigationBarTitle("Icon Search", displayMode: .inline) -// .navigationBarItems(leading: -// Button(action: { -// self.selected = self.initialSelection -// self.showing = false -// }) { -// Text("Cancel") -// }, -// trailing: -// Button(action: { -// print("Done") -// }) { -// Text("Done") -// .disabled(self.selected == nil) -// } -// ) } } } + +#endif