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
// | |
// ThemeManager.swift | |
// ProjectThemeTest | |
// | |
// Copyright (c) 2017 Abhilash | |
// | |
import UIKit | |
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
// | |
// ThemeManager.swift | |
import UIKit | |
import Foundation | |
/// Enum Theme Manager | |
/// - Note: https://github.com/durul/DRL-Theme-Manager | |
enum Theme: Int { | |
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
public class Network:NSObject, URLSessionDelegate, URLSessionTaskDelegate, URLSessionDataDelegate { | |
internal static let sharedInstance = Network() | |
fileprivate var networkParams:Array<NetworkParams> = Array() | |
fileprivate func networkCall(_ request:URLRequest, completionBlock:@escaping NetworkCompletionBlock) | |
{ | |
let configurationId = String(format: "Network%d", arc4random()) | |
let configuration = URLSessionConfiguration.background(withIdentifier: configurationId) | |
configuration.timeoutIntervalForRequest = request.timeoutInterval |
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 | |
extension Data { | |
var prettyPrintedJSONString: NSString? { /// NSString gives us a nice sanitized debugDescription | |
guard let object = try? JSONSerialization.jsonObject(with: self, options: []), | |
let data = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted]), | |
let prettyPrintedString = NSString(data: data, encoding: String.Encoding.utf8.rawValue) else { return nil } | |
return prettyPrintedString | |
} |
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
extension UIApplication { | |
class func appVersion() -> String { | |
return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String | |
} | |
class func appBuild() -> String { | |
return Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as! String | |
} |
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 network | |
import socket | |
import time | |
import struct | |
from machine import Pin | |
NTP_DELTA = 2208988800 | |
host = "pool.ntp.org" |