This file contains 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
// | |
// AppstoreUpdateManager.swift | |
// AppStoreUpdateManager | |
// | |
// Created by Karthik on 7/27/18. | |
// Copyright © 2018 Karthik. All rights reserved. | |
// | |
import Foundation | |
import UIKit |
This file contains 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
// | |
// AppLifecycleTracker.swift | |
// A Swift 4.0 class to keep track of the time an app is in background, foreground, terminated and suspended | |
// Usage: var appLifecycleTracker:AppLifecycleTracker? = AppLifecycleTracker() | |
// Must enable CoreLocation update background mode to allow this to update in BG | |
// Privacy - Location Always and When In Use Usage Description must be in the plist | |
// Test by freeing ram while app is backgrounded to see last suspention time | |
// | |
// Created by Andre Todman on 10/19/18. | |
// |
This file contains 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 UIKit | |
import PluggableApplicationDelegate | |
@UIApplicationMain | |
class AppDelegate: PluggableApplicationDelegate | |
{ | |
override var services: [ApplicationService] { | |
return [ | |
LoggerApplicationService() | |
] |
This file contains 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
// BASIC SWITCH | |
enum Media { case Book } | |
extension Media : CustomStringConvertible | |
{ | |
var description: String { | |
switch self { | |
case .Book: return "bible" | |
} |
This file contains 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
// | |
// ProgrammerAssertions.swift | |
// Assertions | |
// | |
// Created by Mohamed Afifi on 12/20/15. | |
// Copyright © 2015 mohamede1945. All rights reserved. | |
// | |
import Foundation |
This file contains 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
private class ObjectWrapper { | |
let value: Any | |
init(_ value: Any) { | |
self.value = value | |
} | |
} | |
private class KeyWrapper<KeyType: Hashable>: NSObject { | |
let key: KeyType |
This file contains 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 | |
public struct Cache<ValueType> { | |
typealias KeyType = String | |
private class Box<T>: NSObject { | |
let value: T | |
init(_ value: T) { | |
self.value = value | |
super.init() | |
} |
This file contains 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 Result<Value, Error: Swift.Error> { | |
case success(Value) | |
case failure(Error) | |
} | |
enum ApiError: Error { | |
case none | |
var desc: String { | |
return "this is desc" | |
} |
This file contains 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 UIKit | |
/* | |
let greenScene = GreenVC.instantiate(fromAppStoryboard: .Main) | |
let greenScene = AppStoryboard.Main.viewController(viewControllerClass: GreenVC.self) | |
let greenScene = AppStoryboard.Main.instance.instantiateViewController(withIdentifier: GreenVC.storyboardID) | |
*/ | |
// MARK: Storyboard | |
protocol StoryboardIdentifiable { |
This file contains 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 UIKit | |
// MARK: Cache Service | |
struct FlagService { | |
let key: String | |
let bufferTime: Double | |
var canProcess: Bool { | |
let buffer: Double = bufferTime * 60 * 60 |
OlderNewer