From 023a6e7854fc50aea6d2b01945ada16386870efc Mon Sep 17 00:00:00 2001 From: mtfum Date: Mon, 6 Apr 2020 19:37:14 +0900 Subject: [PATCH 1/4] Add Package.swift --- Package.swift | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Package.swift diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..6fcf413 --- /dev/null +++ b/Package.swift @@ -0,0 +1,28 @@ +// swift-tools-version:5.2 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "Permission", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "Permission", + targets: ["Permission"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "Permission", + dependencies: []), + .testTarget( + name: "PermissionTests", + dependencies: ["Permission"]), + ] +) From f3cbbdefe4958b7c84eecf0de28c760335c98153 Mon Sep 17 00:00:00 2001 From: mtfum Date: Mon, 6 Apr 2020 19:49:50 +0900 Subject: [PATCH 2/4] Edit .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 8f68502..dad3ec3 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ xcuserdata # Carthage Carthage/Build + +# SwiftPM +.build From e08918fc331ff046d378fc4579647059d53b7355 Mon Sep 17 00:00:00 2001 From: mtfum Date: Mon, 6 Apr 2020 22:37:55 +0900 Subject: [PATCH 3/4] Fix path --- Package.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 6fcf413..b5a0cd2 100644 --- a/Package.swift +++ b/Package.swift @@ -20,9 +20,10 @@ let package = Package( // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "Permission", - dependencies: []), + path: "Source"), .testTarget( name: "PermissionTests", - dependencies: ["Permission"]), + dependencies: ["Permission"], + path: "Tests"), ] ) From 1d4608aff2335a299b3e39aa872be6c57d5c0299 Mon Sep 17 00:00:00 2001 From: mtfum Date: Mon, 11 May 2020 21:06:22 +0900 Subject: [PATCH 4/4] Add import library --- Package.swift | 25 +++++++------------------ Source/Permission.swift | 2 ++ Source/PermissionAlert.swift | 4 ++++ Source/PermissionButton.swift | 4 ++++ Source/Supporting Files/Utilities.swift | 4 ++++ 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Package.swift b/Package.swift index b5a0cd2..a9a6cdb 100644 --- a/Package.swift +++ b/Package.swift @@ -1,29 +1,18 @@ // swift-tools-version:5.2 -// The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "Permission", - products: [ - // Products define the executables and libraries produced by a package, and make them visible to other packages. - .library( - name: "Permission", - targets: ["Permission"]), + platforms: [ + .iOS(.v10) ], - dependencies: [ - // Dependencies declare other packages that this package depends on. - // .package(url: /* package url */, from: "1.0.0"), + products: [ + .library(name: "Permission", targets: ["Permission"]) ], targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages which this package depends on. - .target( - name: "Permission", - path: "Source"), - .testTarget( - name: "PermissionTests", - dependencies: ["Permission"], - path: "Tests"), + .target(name: "Permission", path: "Source"), + .testTarget(name: "PermissionTests", dependencies: ["Permission"], path: "Tests") ] ) + diff --git a/Source/Permission.swift b/Source/Permission.swift index 6cf36c0..2800c1d 100644 --- a/Source/Permission.swift +++ b/Source/Permission.swift @@ -22,6 +22,8 @@ // SOFTWARE. // +import Foundation + open class Permission: NSObject { public typealias Callback = (PermissionStatus) -> Void diff --git a/Source/PermissionAlert.swift b/Source/PermissionAlert.swift index 6a9904c..d860166 100644 --- a/Source/PermissionAlert.swift +++ b/Source/PermissionAlert.swift @@ -22,6 +22,10 @@ // SOFTWARE. // +#if canImport(UIKit) +import UIKit +#endif + open class PermissionAlert { /// The permission. fileprivate let permission: Permission diff --git a/Source/PermissionButton.swift b/Source/PermissionButton.swift index e6eea9a..fc09101 100644 --- a/Source/PermissionButton.swift +++ b/Source/PermissionButton.swift @@ -22,6 +22,10 @@ // SOFTWARE. // +#if canImport(UIKit) +import UIKit +#endif + open class PermissionButton: UIButton { /// The permission of the button. diff --git a/Source/Supporting Files/Utilities.swift b/Source/Supporting Files/Utilities.swift index 6dc00e5..86484db 100644 --- a/Source/Supporting Files/Utilities.swift +++ b/Source/Supporting Files/Utilities.swift @@ -22,6 +22,10 @@ // SOFTWARE. // +#if canImport(UIKit) +import UIKit +#endif + extension UIApplication { private var topViewController: UIViewController? { var vc = keyWindow?.rootViewController