Skip to content

Instantly share code, notes, and snippets.

View karthikAdaptavant's full-sized avatar
🎯
Focusing

Karthik samy karthikAdaptavant

🎯
Focusing
  • 05:55 (UTC +05:30)
View GitHub Profile
//
// AppstoreUpdateManager.swift
// AppStoreUpdateManager
//
// Created by Karthik on 7/27/18.
// Copyright © 2018 Karthik. All rights reserved.
//
import Foundation
import UIKit
@karthikAdaptavant
karthikAdaptavant / AppLifecycleTracker.swift
Created June 2, 2019 12:46 — forked from andretodman/AppLifecycleTracker.swift
A Swift 4.0 class to keep track of the time an app is in background, foreground, terminated and suspended
//
// 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.
//
import UIKit
import PluggableApplicationDelegate
@UIApplicationMain
class AppDelegate: PluggableApplicationDelegate
{
override var services: [ApplicationService] {
return [
LoggerApplicationService()
]
// BASIC SWITCH
enum Media { case Book }
extension Media : CustomStringConvertible
{
var description: String {
switch self {
case .Book: return "bible"
}
//
// ProgrammerAssertions.swift
// Assertions
//
// Created by Mohamed Afifi on 12/20/15.
// Copyright © 2015 mohamede1945. All rights reserved.
//
import Foundation
private class ObjectWrapper {
let value: Any
init(_ value: Any) {
self.value = value
}
}
private class KeyWrapper<KeyType: Hashable>: NSObject {
let key: KeyType
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()
}
enum Result<Value, Error: Swift.Error> {
case success(Value)
case failure(Error)
}
enum ApiError: Error {
case none
var desc: String {
return "this is desc"
}
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 {
import UIKit
// MARK: Cache Service
struct FlagService {
let key: String
let bufferTime: Double
var canProcess: Bool {
let buffer: Double = bufferTime * 60 * 60