Skip to content

Commit eb6aeac

Browse files
committed
fix errors
1 parent 92fc190 commit eb6aeac

File tree

4 files changed

+159
-8
lines changed

4 files changed

+159
-8
lines changed

LCPermissionsKit.podspec

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
#
2+
# Be sure to run `pod spec lint LCPermissionsKit.podspec' to ensure this is a
3+
# valid spec and to remove all comments including this before submitting the spec.
4+
#
5+
# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html
6+
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
7+
#
8+
9+
Pod::Spec.new do |spec|
10+
11+
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
12+
#
13+
# These will help people to find your library, and whilst it
14+
# can feel like a chore to fill in it's definitely to your advantage. The
15+
# summary should be tweet-length, and the description more in depth.
16+
#
17+
18+
spec.name = "LCPermissionsKit"
19+
spec.version = "1.0.0"
20+
spec.summary = "LCPermissionsKit is a convenient wrapper on the macOS permissions API"
21+
22+
# This description is used to generate tags and improve search results.
23+
# * Think: What does it do? Why did you write it? What is the focus?
24+
# * Try to keep it short, snappy and to the point.
25+
# * Write the description between the DESC delimiters below.
26+
# * Finally, don't worry about the indent, CocoaPods strips it!
27+
spec.description = <<-DESC
28+
LCPermissionsKit is a convenient wrapper on the macOS permissions API, including photos, contacts, reminders, and full disk access permissions
29+
DESC
30+
31+
spec.homepage = "https://github.com/DevLiuSir/LCPermissionsKit"
32+
# spec.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
33+
34+
35+
# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
36+
#
37+
# Licensing your code is important. See https://choosealicense.com for more info.
38+
# CocoaPods will detect a license file if there is a named LICENSE*
39+
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
40+
#
41+
42+
# spec.license = "MIT"
43+
spec.license = { :type => "MIT", :file => "LICENSE" }
44+
45+
46+
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
47+
#
48+
# Specify the authors of the library, with email addresses. Email addresses
49+
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
50+
# accepts just a name if you'd rather not provide an email address.
51+
#
52+
# Specify a social_media_url where others can refer to, for example a twitter
53+
# profile URL.
54+
#
55+
56+
spec.author = { "Marvin" => "[email protected]" }
57+
# Or just: spec.author = "Marvin"
58+
# spec.authors = { "Marvin" => "[email protected]" }
59+
# spec.social_media_url = "https://twitter.com/Marvin"
60+
61+
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
62+
#
63+
# If this Pod runs only on iOS or OS X, then specify the platform and
64+
# the deployment target. You can optionally include the target after the platform.
65+
#
66+
67+
spec.swift_versions = ['5.0']
68+
spec.platform = :osx
69+
spec.osx.deployment_target = "10.13"
70+
71+
# spec.platform = :ios
72+
# spec.platform = :ios, "5.0"
73+
74+
# When using multiple platforms
75+
# spec.ios.deployment_target = "5.0"
76+
# spec.osx.deployment_target = "10.7"
77+
# spec.watchos.deployment_target = "2.0"
78+
# spec.tvos.deployment_target = "9.0"
79+
# spec.visionos.deployment_target = "1.0"
80+
81+
82+
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
83+
#
84+
# Specify the location from where the source should be retrieved.
85+
# Supports git, hg, bzr, svn and HTTP.
86+
#
87+
88+
spec.source = { :git => "https://github.com/DevLiuSir/LCPermissionsKit.git", :tag => "#{spec.version}" }
89+
90+
91+
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
92+
#
93+
# CocoaPods is smart about how it includes source code. For source files
94+
# giving a folder will include any swift, h, m, mm, c & cpp files.
95+
# For header files it will include any header in the folder.
96+
# Not including the public_header_files will make all headers public.
97+
#
98+
99+
spec.source_files = ["LCPermissionsKit/**/*.swift"]
100+
101+
# spec.source_files = "LCPermissionsKit/Public/**/*", "LCPermissionsKit/Private/**/*"
102+
# spec.exclude_files = "LCPermissionsKit/Exclude"
103+
# spec.public_header_files = 'LCPermissionsKit/Public/**/*.h', 'LCPermissionsKit/PermissionsKit.h'
104+
105+
# spec.public_header_files = "Classes/**/*.h"
106+
107+
108+
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
109+
#
110+
# A list of resources included with the Pod. These are copied into the
111+
# target bundle with a build phase script. Anything else will be cleaned.
112+
# You can preserve files from being cleaned, please don't preserve
113+
# non-essential files like tests, examples and documentation.
114+
#
115+
116+
# spec.resource = "icon.png"
117+
# spec.resources = "Resources/*.png"
118+
119+
# spec.preserve_paths = "FilesToSave", "MoreFilesToSave"
120+
121+
122+
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
123+
#
124+
# Link your library with frameworks, or libraries. Libraries do not include
125+
# the lib prefix of their name.
126+
#
127+
128+
spec.frameworks = 'Cocoa', 'Contacts', 'EventKit', 'Photos'
129+
130+
# spec.framework = "SomeFramework"
131+
# spec.frameworks = "SomeFramework", "AnotherFramework"
132+
133+
# spec.library = "iconv"
134+
# spec.libraries = "iconv", "xml2"
135+
136+
137+
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
138+
#
139+
# If your library depends on compiler flags you can set them in the xcconfig hash
140+
# where they will only apply to your library. If you depend on other Podspecs
141+
# you can include multiple dependencies to ensure it works.
142+
143+
# spec.requires_arc = true
144+
145+
# spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
146+
# spec.dependency "JSONKit", "~> 1.4"
147+
148+
end

LCPermissionsKit/Pubilc/LCAuthorizationStatus.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99

1010

1111
/// 授权状态
12-
enum LCAuthorizationStatus: Int {
12+
public enum LCAuthorizationStatus: Int {
1313
/// 未确定状态,用户尚未做出授权选择
1414
case notDetermined
1515
/// 拒绝授权状态,用户明确拒绝了权限

LCPermissionsKit/Pubilc/LCPermissionType.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99

1010
/// 权限类型
11-
enum LCPermissionType: Int {
11+
public enum LCPermissionType: Int {
1212
/// 日历权限
1313
case calendar = 0
1414
/// 提醒事项权限

LCPermissionsKit/Pubilc/LCPermissionsKit.swift

+9-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
import Foundation
99

1010

11-
class LCPermissionsKit: NSObject {
11+
public class LCPermissionsKit: NSObject {
12+
13+
/// 单列
14+
public static let shared = LCPermissionsKit()
1215

1316
/// `权限类型`对应的`授权器集合`
1417
private static let authorizers: [LCPermissionType: LCAuthorizer] = [
@@ -19,9 +22,9 @@ class LCPermissionsKit: NSObject {
1922
.fullDiskAccess: LCFullDiskAccessAuthorizer()
2023
]
2124

22-
/// 获取指定权限类型的授权状态
23-
static func authorizationStatus(for permissionType: LCPermissionType) -> LCAuthorizationStatus {
24-
guard let authorizer = authorizers[permissionType] else {
25+
/// 获取`指定权限类型`的`授权状态`
26+
public func authorizationStatus(for permissionType: LCPermissionType) -> LCAuthorizationStatus {
27+
guard let authorizer = LCPermissionsKit.authorizers[permissionType] else {
2528
fatalError("无法找到类型为 \(permissionType) 的授权器")
2629
}
2730
return authorizer.authorizationStatus()
@@ -32,8 +35,8 @@ class LCPermissionsKit: NSObject {
3235
/// - Parameters:
3336
/// - permissionType: 要请求授权的权限类型
3437
/// - completionHandler: 授权请求完成后的回调,返回授权状态
35-
static func requestAuthorization(for permissionType: LCPermissionType, withCompletion completionHandler: @escaping (LCAuthorizationStatus) -> Void) {
36-
guard let authorizer = authorizers[permissionType] else {
38+
public func requestAuthorization(for permissionType: LCPermissionType, withCompletion completionHandler: @escaping (LCAuthorizationStatus) -> Void) {
39+
guard let authorizer = LCPermissionsKit.authorizers[permissionType] else {
3740
fatalError("无法找到类型为 \(permissionType) 的授权器")
3841
}
3942
authorizer.requestAuthorization(withCompletion: completionHandler)

0 commit comments

Comments
 (0)