Skip to content

Commit

Permalink
Adds SPPermissions as source dependency (#26)
Browse files Browse the repository at this point in the history
* Adds SPPermissions as source dependency
* Excludes Vendor folder from swiftlint config
  • Loading branch information
bielikb committed May 6, 2020
1 parent cabd3bd commit 14bac3b
Show file tree
Hide file tree
Showing 31 changed files with 3,499 additions and 0 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Expand Up @@ -4,6 +4,7 @@ disabled_rules:

excluded:
- Pods
- Vendor

indentation: tabs

Expand Down
91 changes: 91 additions & 0 deletions Vendor/SPPermissions/Data/SPPermissionsColor.swift
@@ -0,0 +1,91 @@
// The MIT License (MIT)
// Copyright © 2019 Ivan Varabei (varabeis@icloud.com)
//
// 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

enum SPPermissionsColor {

static var base: UIColor {
return UIColor.systemBlue
}

static var black: UIColor {
return UIColor.black
}

static var white: UIColor {
return UIColor.white
}

static var systemBackground: UIColor {
#if os(iOS)
if #available(iOS 13.0, *) {
return UIColor.systemBackground
}
#endif
return UIColor.white
}

static var secondarySystemBackground: UIColor {
#if os(iOS)
if #available(iOS 13.0, *) {
return UIColor.secondarySystemBackground
}
#endif
return UIColor(red: 242/255, green: 242/255, blue: 247/255, alpha: 1)
}

static var separator: UIColor {
if #available(iOS 13.0, tvOS 13.0, *) {
return UIColor.separator
} else {
return UIColor(red: 60/255, green: 60/255, blue: 67/255, alpha: 1)
}
}

static var label: UIColor {
if #available(iOS 13.0, tvOS 13.0, *) {
return UIColor.label
} else {
return UIColor.black
}
}

static var secondaryLabel: UIColor {
if #available(iOS 13.0, tvOS 13.0, *) {
return UIColor.secondaryLabel
} else {
return UIColor(red: 138/255, green: 138/255, blue: 142/255, alpha: 1)
}
}

static var buttonArea: UIColor {
if #available(iOS 13.0, tvOS 13.0, *) {
return UIColor { (traits) -> UIColor in
return traits.userInterfaceStyle == .dark ? UIColor(red: 61/255, green: 62/255, blue: 66/255, alpha: 1) :
UIColor(red: 238/255, green: 238/255, blue: 240/255, alpha: 1)
}
} else {
return UIColor(red: 238/255, green: 238/255, blue: 240/255, alpha: 1)
}
}
}

32 changes: 32 additions & 0 deletions Vendor/SPPermissions/Data/SPPermissionsDelay.swift
@@ -0,0 +1,32 @@
// The MIT License (MIT)
// Copyright © 2019 Ivan Varabei (varabeis@icloud.com)
//
// 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

enum SPPermissionsDelay {

public static func wait(_ delay: Double, closure: @escaping ()->()) {
let when = DispatchTime.now() + delay
DispatchQueue.main.asyncAfter(deadline: when) {
closure()
}
}
}

0 comments on commit 14bac3b

Please sign in to comment.