This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension Collection { | |
| public subscript(safe index: Index) -> Optional<Iterator.Element> { | |
| guard self.startIndex..<self.endIndex ~= index else { return nil } | |
| return self[index] | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public extension UIFont { | |
| public class func systemFont(ofSize fontSize: CGFloat, weight: UIFontWeight) -> UIFont { | |
| return .systemFont(ofSize: fontSize, weight: weight.floatValue) | |
| } | |
| public class func monospacedDigitSystemFont(ofSize fontSize: CGFloat, weight: UIFontWeight) -> UIFont { | |
| return .monospacedDigitSystemFont(ofSize: fontSize, weight: weight.floatValue) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import SwiftyJSON | |
| extension JSON { | |
| public var decimal: Decimal? { | |
| get { | |
| switch self.type { | |
| case .string: | |
| return Decimal(string: self.object as! String) | |
| case .number: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension UITableView { | |
| //deselect any row that may be selected | |
| public func deselectAnyRow(animated: Bool = true) { | |
| if let indexPath = self.indexPathForSelectedRow { | |
| self.deselectRow(at: indexPath, animated: animated) | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum ExternalIntent { | |
| case content(id: String) | |
| case timeline | |
| case example | |
| init?(launchOptions: [UIApplicationLaunchOptionsKey: Any]?) { | |
| guard let launchOptions = launchOptions else { return nil } | |
| if let url = launchOptions[.url] as? URL { | |
| self.init(url: url) | |
| } else if let shortcutItem = launchOptions[.shortcutItem] as? UIApplicationShortcutItem { |
NewerOlder