Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0c98c3c699 | |||
| 4ecc8e96d8 | |||
| fac454f41d | |||
| ae68a1be5d | |||
| c111a20c86 | |||
| cc1b1ac604 | |||
| 265f77dd5e | |||
| aacf153d0e | |||
| 5b8fdf6590 |
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+1
-1
@@ -23,7 +23,7 @@ import UIKit
|
||||
|
||||
public struct SPStorkController {
|
||||
|
||||
static func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
static public func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
if let controller = self.controller(for: scrollView) {
|
||||
if let presentationController = controller.presentationController as? SPStorkPresentationController {
|
||||
let translation = -(scrollView.contentOffset.y + scrollView.contentInset.top)
|
||||
+4
-5
@@ -270,6 +270,7 @@ extension SPStorkPresentationController {
|
||||
animations: {
|
||||
self.snapshotView?.transform = .identity
|
||||
self.presentedView?.transform = .identity
|
||||
self.gradeView.alpha = self.alpha
|
||||
})
|
||||
}
|
||||
default:
|
||||
@@ -302,11 +303,9 @@ extension SPStorkPresentationController {
|
||||
|
||||
self.presentedView?.transform = CGAffineTransform(translationX: 0, y: translationForModal)
|
||||
|
||||
if !self.presentingViewController.isPresentedAsStork {
|
||||
let factor = 1 + (translationForModal / 6000)
|
||||
self.snapshotView?.transform = CGAffineTransform.init(scaleX: factor, y: factor)
|
||||
self.gradeView.alpha = self.alpha - ((factor - 1) * 15)
|
||||
}
|
||||
let factor = 1 + (translationForModal / 6000)
|
||||
self.snapshotView?.transform = CGAffineTransform.init(scaleX: factor, y: factor)
|
||||
self.gradeView.alpha = self.alpha - ((factor - 1) * 15)
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -23,8 +23,8 @@ import UIKit
|
||||
|
||||
public final class SPStorkTransitioningDelegate: NSObject, UIViewControllerTransitioningDelegate {
|
||||
|
||||
var isSwipeToDismissEnabled: Bool = true
|
||||
var showIndicator: Bool = true
|
||||
public var isSwipeToDismissEnabled: Bool = true
|
||||
public var showIndicator: Bool = true
|
||||
|
||||
public func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
|
||||
let controller = SPStorkPresentationController(presentedViewController: presented, presenting: presenting)
|
||||
@@ -0,0 +1,60 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright © 2017 Ivan Vorobei (hello@ivanvorobei.by)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
import UIKit
|
||||
import LocalAuthentication
|
||||
|
||||
struct SPLocalAuthentication {
|
||||
|
||||
static var isEnable: Bool {
|
||||
let context = LAContext()
|
||||
var error: NSError?
|
||||
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
|
||||
return true
|
||||
} else {
|
||||
if context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func request(reason: String, complecton: @escaping (Bool)->()) {
|
||||
let context = LAContext()
|
||||
var error: NSError?
|
||||
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
|
||||
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason) { success, error in
|
||||
DispatchQueue.main.async { complecton(success) }
|
||||
}
|
||||
} else {
|
||||
if context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) {
|
||||
context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason) { success, error in
|
||||
DispatchQueue.main.async { complecton(success) }
|
||||
}
|
||||
} else {
|
||||
complecton(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private init() {}
|
||||
}
|
||||
+3
@@ -30,6 +30,7 @@ struct SPDownloader {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
URLSession.shared.dataTask(with: url) { (data, response, error) in
|
||||
guard
|
||||
let httpURLResponse = response as? HTTPURLResponse, httpURLResponse.statusCode == 200,
|
||||
@@ -47,6 +48,8 @@ struct SPDownloader {
|
||||
}
|
||||
}.resume()
|
||||
}
|
||||
|
||||
private init() {}
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -55,12 +55,10 @@ extension UIViewController {
|
||||
extension UIViewController {
|
||||
|
||||
func save(image: UIImage) {
|
||||
if SPPermission.isAllow(.photoLibrary) {
|
||||
if PHPhotoLibrary.authorizationStatus() == PHAuthorizationStatus.authorized {
|
||||
UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(_:didFinishSavingWithError:contextInfo:)), nil)
|
||||
} else {
|
||||
SPPermission.request(.photoLibrary) {
|
||||
UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(_:didFinishSavingWithError:contextInfo:)), nil)
|
||||
}
|
||||
print("Saving image error. Not allowed permission")
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -21,7 +21,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class SPLayout {
|
||||
struct SPLayout {
|
||||
|
||||
static func sizeWith(widthFactor: CGFloat, maxWidth: CGFloat, heightFactor: CGFloat, maxHeight: CGFloat, relativeSideFactor: CGFloat, from relativeSize: CGSize) -> CGSize {
|
||||
|
||||
@@ -39,4 +39,6 @@ class SPLayout {
|
||||
}
|
||||
return CGSize.init(width: prepareWidth, height: prepareHeight)
|
||||
}
|
||||
|
||||
private init() {}
|
||||
}
|
||||
-6
@@ -33,12 +33,6 @@ public extension String {
|
||||
}
|
||||
}
|
||||
|
||||
public extension Bool {
|
||||
public static func random() -> Bool {
|
||||
return arc4random_uniform(2) == 0
|
||||
}
|
||||
}
|
||||
|
||||
public extension Int {
|
||||
public static func random(_ n: Int) -> Int {
|
||||
return Int(arc4random_uniform(UInt32(n)))
|
||||
+2
@@ -57,4 +57,6 @@ struct SPSpotlight {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private init() {}
|
||||
}
|
||||
-44
@@ -63,50 +63,6 @@ public enum SPSeparatorInsetStyle {
|
||||
case auto
|
||||
}
|
||||
|
||||
@objc public enum SPPermissionType: Int {
|
||||
case camera = 0
|
||||
case photoLibrary = 1
|
||||
case notification = 2
|
||||
case microphone = 3
|
||||
case calendar = 4
|
||||
case contacts = 5
|
||||
case reminders = 6
|
||||
case speech = 7
|
||||
case locationAlways = 8
|
||||
case locationWhenInUse = 9
|
||||
case locationWithBackground = 10
|
||||
case mediaLibrary = 11
|
||||
|
||||
var name: String {
|
||||
switch self {
|
||||
case .camera:
|
||||
return "Camera"
|
||||
case .photoLibrary:
|
||||
return "Photo Library"
|
||||
case .notification:
|
||||
return "Notification"
|
||||
case .microphone:
|
||||
return "Microphone"
|
||||
case .calendar:
|
||||
return "Calendar"
|
||||
case .contacts:
|
||||
return "Contacts"
|
||||
case .reminders:
|
||||
return "Reminders"
|
||||
case .speech:
|
||||
return "Speech"
|
||||
case .locationAlways:
|
||||
return "Location"
|
||||
case .locationWhenInUse:
|
||||
return "Location"
|
||||
case .locationWithBackground:
|
||||
return "Location"
|
||||
case .mediaLibrary:
|
||||
return "Media Library"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum SPNavigationTitleStyle {
|
||||
case large
|
||||
case small
|
||||
-1
@@ -76,5 +76,4 @@ class SPSystemIconButton: UIButton {
|
||||
super.layoutSubviews()
|
||||
self.iconView.setEqualsFrameFromBounds(self, withWidthFactor: self.widthIconFactor, withHeightFactor: self.heightIconFactor, withCentering: true)
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user