Skip to content

Commit 9d9673c

Browse files
committed
Removed precise library. Moved precise to location permissions. Updated Readme.
1 parent ff22623 commit 9d9673c

File tree

30 files changed

+110
-238
lines changed

30 files changed

+110
-238
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
/Assets
2-
31
# osX files
42
.DS_Store
53
.Trashes
64

75
# Swift Package Manager
86
.swiftpm
7+
8+
# User Interface
9+
*UserInterfaceState.xcuserstate

Example Apps/iOS Example/Scenes/RootController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import SPPermissionsHealth
4343

4444
class RootController: SPTableViewController {
4545

46-
var availablePermissions: [SPPermissions.Permission] = [.camera, .photoLibrary, .notification, .microphone, .calendar, .contacts, .reminders, .speech, .locationWhenInUse, .locationAlways, .locationWhenInUsePrecise, .locationAlwaysPrecise, .motion, .mediaLibrary, .bluetooth, /*.tracking,*/ .faceID, .siri, .health]
46+
var availablePermissions: [SPPermissions.Permission] = [.camera, .photoLibrary, .notification, .microphone, .calendar, .contacts, .reminders, .speech, .locationWhenInUse, .locationAlways, .motion, .mediaLibrary, .bluetooth, /*.tracking,*/ .faceID, .siri, .health]
4747

4848
var selectedPermissions: [SPPermissions.Permission] = []
4949

@@ -66,7 +66,7 @@ class RootController: SPTableViewController {
6666
override func viewDidLoad() {
6767
super.viewDidLoad()
6868
navigationItem.title = "Choose Style"
69-
69+
SPPermissions.Permission.locationWhenInUse.isPrecise
7070
// Available styles: List, Dialog & Native.
7171
let segmentedControl = UISegmentedControl(items: ["List", "Dialog", "Native"])
7272
navigationItem.titleView = segmentedControl

Package.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ let package = Package(
9191
.define("SPPERMISSIONS_SPM")
9292
]
9393
),
94+
.target(
95+
name: "SPPermissionsLocationExtension",
96+
swiftSettings: [
97+
.define("SPPERMISSIONS_SPM")
98+
]
99+
),
94100
.target(
95101
name: "SPPermissionsCamera",
96102
dependencies: [.target(name: "SPPermissions")],
@@ -157,15 +163,21 @@ let package = Package(
157163
),
158164
.target(
159165
name: "SPPermissionsLocationWhenInUse",
160-
dependencies: [.target(name: "SPPermissions")],
166+
dependencies: [
167+
.target(name: "SPPermissions"),
168+
.target(name: "SPPermissionsLocationExtension")
169+
],
161170
swiftSettings: [
162171
.define("SPPERMISSIONS_LOCATION_WHENINUSE"),
163172
.define("SPPERMISSIONS_SPM")
164173
]
165174
),
166175
.target(
167176
name: "SPPermissionsLocationAlways",
168-
dependencies: [.target(name: "SPPermissions")],
177+
dependencies: [
178+
.target(name: "SPPermissions"),
179+
.target(name: "SPPermissionsLocationExtension")
180+
],
169181
swiftSettings: [
170182
.define("SPPERMISSIONS_LOCATION_ALWAYS"),
171183
.define("SPPERMISSIONS_SPM")

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Availalbe three ready-use interface - list, dialog & native. Supports iPad, dark
3838
- [Imports](#imports)
3939
- [Quick Start](#quick-start)
4040
- [Status](#status)
41+
- [Location](#location)
4142
- [Request](#request)
4243
- [List](#list)
4344
- [Dialog](#dialog)
@@ -53,7 +54,7 @@ Availalbe three ready-use interface - list, dialog & native. Supports iPad, dark
5354

5455
## Installation
5556

56-
Ready to use on iOS 11+, and supports iOS, tvOS, and SwiftUI.
57+
Ready to use on iOS 11+. Supports iOS, tvOS, and `SwiftUI`.
5758

5859
### Swift Package Manager
5960

@@ -63,7 +64,7 @@ Once you have your Swift package set up, adding as a dependency is as easy as ad
6364

6465
```swift
6566
dependencies: [
66-
.package(url: "https://github.com/ivanvorobei/SPPermissions", .upToNextMajor(from: "7.0.1"))
67+
.package(url: "https://github.com/ivanvorobei/SPPermissions", .upToNextMajor(from: "7.1.0"))
6768
]
6869
```
6970

@@ -205,6 +206,16 @@ let authorized = SPPermissions.Permission.calendar.authorized
205206

206207
Also available are status for `denied` & `notDetermined`.
207208

209+
### Location
210+
211+
For location user can granted `precise` or not. For get state for it, call this:
212+
213+
```swift
214+
if SPPermissions.Permission.locationWhenInUse.isPrecise { ... }
215+
```
216+
217+
Same for `.locationAlways`.
218+
208219
## Request
209220

210221
`SPPermissions` has three presentation styles: `Dialog`, `List` and `Native`. Each interface has delegates and a data source. If you want see an example app, open `Example Apps/SPPermissions.xcodeproj`.

SPPermissions.podspec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "SPPermissions"
4-
s.version = "7.0.1"
4+
s.version = "7.1.0"
55
s.summary = "Ask permissions with ready-use interface. You can check status permission and if it has been requested before. Support SwiftUI."
66
s.homepage = "https://github.com/ivanvorobei/SPPermissions"
77
s.source = { :git => "https://github.com/ivanvorobei/SPPermissions.git", :tag => s.version }
@@ -93,9 +93,14 @@ Pod::Spec.new do |s|
9393
"SWIFT_ACTIVE_COMPILATION_CONDITIONS" => "SPPERMISSIONS_SPEECH SPPERMISSIONS_COCOAPODS"
9494
}
9595
end
96+
97+
s.subspec 'LocationExtension' do |subspec|
98+
subspec.source_files = "Sources/SPPermissionsLocationExtension/**/*.swift"
99+
end
96100

97101
s.subspec 'LocationWhenInUse' do |subspec|
98102
subspec.dependency 'SPPermissions/Core'
103+
subspec.dependency 'SPPermissions/LocationExtension'
99104
subspec.source_files = "Sources/SPPermissionsLocationWhenInUse/**/*.swift"
100105
subspec.pod_target_xcconfig = {
101106
"SWIFT_ACTIVE_COMPILATION_CONDITIONS" => "SPPERMISSIONS_LOCATION_WHENINUSE SPPERMISSIONS_COCOAPODS"
@@ -104,6 +109,7 @@ Pod::Spec.new do |s|
104109

105110
s.subspec 'LocationAlways' do |subspec|
106111
subspec.dependency 'SPPermissions/Core'
112+
subspec.dependency 'SPPermissions/LocationExtension'
107113
subspec.source_files = "Sources/SPPermissionsLocationAlways/**/*.swift"
108114
subspec.pod_target_xcconfig = {
109115
"SWIFT_ACTIVE_COMPILATION_CONDITIONS" => "SPPERMISSIONS_LOCATION_ALWAYS SPPERMISSIONS_COCOAPODS"

Sources/SPPermissions/Data/Images.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ enum Images {
5959
return UIImage.init(named: "Siri", in: bundle, compatibleWith: nil) ?? UIImage()
6060
case .health:
6161
return UIImage.init(named: "Health", in: bundle, compatibleWith: nil) ?? UIImage()
62-
case .locationWhenInUsePrecise:
63-
return UIImage.init(named: "Location", in: bundle, compatibleWith: nil) ?? UIImage()
64-
case .locationAlwaysPrecise:
65-
return UIImage.init(named: "Location", in: bundle, compatibleWith: nil) ?? UIImage()
6662
}
6763
}
6864

Sources/SPPermissions/Data/Text.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ enum Texts {
5959
return NSLocalizedString("permission siri name", bundle: bundle, comment: "")
6060
case .health:
6161
return NSLocalizedString("permission health name", bundle: bundle, comment: "")
62-
case .locationWhenInUsePrecise:
63-
return NSLocalizedString("permission location precise when in use name", bundle: bundle, comment: "")
64-
case .locationAlwaysPrecise:
65-
return NSLocalizedString("permission location precise always name", bundle: bundle, comment: "")
6662
}
6763
}
6864

@@ -102,10 +98,6 @@ enum Texts {
10298
return NSLocalizedString("permission siri description", bundle: bundle, comment: "")
10399
case .health:
104100
return NSLocalizedString("permission health description", bundle: bundle, comment: "")
105-
case .locationWhenInUsePrecise:
106-
return NSLocalizedString("permission location precise when in use description", bundle: bundle, comment: "")
107-
case .locationAlwaysPrecise:
108-
return NSLocalizedString("permission location precise always description", bundle: bundle, comment: "")
109101
}
110102
}
111103

Sources/SPPermissions/Interface/Shared/SPPermissionsDrawIconView.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ public class SPPermissionsDrawIconView: UIView {
8282
case .faceID, .siri, .health:
8383
// Not implemented old style icons.
8484
break
85-
case .locationWhenInUsePrecise:
86-
DrawService.drawLocations(frame: rect, resizing: .aspectFit, color: tintColor)
87-
case .locationAlwaysPrecise:
88-
DrawService.drawLocations(frame: rect, resizing: .aspectFit, color: tintColor)
8985
case .none:
9086
break
9187
}

Sources/SPPermissions/Resources/Localization/ar.lproj/Localizable.strings

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@
6262

6363
"permission location always description" = "السماح للوصول إلى موقعك";
6464

65-
"permission location precise when in use name" = "الموقع الدقيق عند الاستخدام";
66-
67-
"permission location precise always name" = "الموقع الدقيق دائمًا";
68-
69-
"permission location precise when in use description" = "اسمح بالوصول إلى موقعك الدقيق";
70-
71-
"permission location precise always description" = "اسمح بالوصول إلى موقعك الدقيق";
72-
7365
"permission tracking name" = "تتبع";
7466

7567
"permission tracking description" = "السماح بالوصول إلى البيانات المتعلقة بالتطبيق";

0 commit comments

Comments
 (0)