- confortable vs convenient
- One is fun vs One is funny
- wanna drink some beer, wanna == want to
- explain to smb
- Should vs got to (gotta) - should is optinal
- What is this called
- Feel good/bad
- understand vs realize
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 Alamofire | |
import AlamofireObjectMapper | |
class Network: NSObject, URLSessionDelegate { | |
static let shared = Network() | |
let baseURL = baseURL | |
var sessionManager = Alamofire.SessionManager.default | |
let networkQueue = DispatchQueue.global(qos: .utility) |
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 Alamofire | |
import AlamofireObjectMapper | |
enum Router: URLRequestConvertible { | |
static let baseURLString = baseURL + "/requestPath" | |
case get | |
func asURLRequest() throws -> URLRequest{ | |
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
func printJSONDictionary(payload: [String: Any]){ | |
if let theJSONData = try? JSONSerialization.data(withJSONObject: payload, options: .prettyPrinted), | |
let theJSONText = String(data: theJSONData, encoding: String.Encoding.ascii){ | |
print("JSON string = \n\(theJSONText)") | |
} | |
} |
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 Form: CustomDebugStringConvertible{ | |
public var debugDescription: String { | |
return "\(type(of: self)): \(address(o: self)) \n---------\n\(self.allRows)" | |
} | |
} | |
extension Section: CustomDebugStringConvertible{ | |
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 UIView { | |
func snapshot() -> UIImage { | |
UIGraphicsBeginImageContextWithOptions(bounds.size, false, UIScreen.main.scale) | |
drawHierarchy(in: bounds, afterScreenUpdates: true) | |
let result = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
return result! | |
} | |
} |
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
class EmptyResult: Mappable { | |
required init?(map: Map) {} | |
func mapping(map: Map) { | |
} | |
} | |
class FailableObject<T: Mappable, E: Mappable> : Mappable { | |
var object: T? | |
var error: E? | |
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
// create header with custom view | |
// create row with custom view | |
// section animation |
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
protocol ErrorPresenting { | |
func presentError(title: String, message: String) | |
} | |
extension ErrorPresenting where Self: UIViewController { | |
func presentError(title: String, message: String) { | |
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) | |
let dismissAction = UIAlertAction(title: "OK", style: .default, handler: nil) | |
alertController.addAction(dismissAction) | |
present(alertController, animated: true) |
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 UIImage { | |
public func imageCenteredInParentWithSize(ratio: CGFloat, backgroundColor: UIColor = UIColor.clear) -> UIImage? { | |
let width = self.size.width | |
let height = width * ratio | |
let frameSize = CGSize(width: width, height: height) | |
UIGraphicsBeginImageContextWithOptions(frameSize, true, UIScreen.main.scale) | |
let context = UIGraphicsGetCurrentContext()! |