I hereby claim:
- I am kharrison on github.
- I am kharrison (https://keybase.io/kharrison) on keybase.
- I have a public key whose fingerprint is DA8F 843F AD53 60FB 293B 83FA A8A6 9ECD A775 E681
To claim this, I am signing this object:
public enum NetworkingError: Error { | |
case unknown | |
case unexpectedStatus(HTTPURLResponse) | |
} | |
extension URLSession { | |
func load(_ url: URL, | |
completionHandler: @escaping (Result<Data, Error>) -> Void) | |
-> URLSessionDataTask { | |
let task = dataTask(with: url) { data, response, error in |
// Example of refactoring with protocols | |
// Original javascript version is from Refactoring (2nd Edition) by Martin Fowler | |
import Foundation | |
struct Play { | |
enum Genre { | |
case tragedy | |
case comedy | |
} |
import Foundation | |
extension DateFormatter { | |
static let iso8601Full: DateFormatter = { | |
let formatter = DateFormatter() | |
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" | |
formatter.calendar = Calendar(identifier: .iso8601) | |
formatter.timeZone = TimeZone(secondsFromGMT: 0) | |
formatter.locale = Locale(identifier: "en_US_POSIX") | |
return formatter |
// ------------------------------------- | |
// Swift Integer Quick Guide | |
// ------------------------------------- | |
// Created by Keith Harrison http://useyourloaf.com | |
// Copyright (c) 2017 Keith Harrison. All rights reserved. | |
// | |
// Redistribution and use in source and binary forms, with or without | |
// modification, are permitted provided that the following conditions are met: | |
// |
import Foundation | |
struct Country { | |
let name: String | |
let capital: String | |
var visited: Bool | |
} | |
extension Country: Equatable { | |
static func == (lhs: Country, rhs: Country) -> Bool { |
// | |
// CoreDataController.h | |
// | |
// Created by Keith Harrison http://useyourloaf.com | |
// Copyright (c) 2016 Keith Harrison. All rights reserved. | |
// | |
// Redistribution and use in source and binary forms, with or without | |
// modification, are permitted provided that the following conditions are met: | |
// | |
// 1. Redistributions of source code must retain the above copyright |
// | |
// CoreDataController.swift | |
// | |
// Created by Keith Harrison http://useyourloaf.com | |
// Copyright (c) 2017 Keith Harrison. All rights reserved. | |
// | |
// Redistribution and use in source and binary forms, with or without | |
// modification, are permitted provided that the following conditions are met: | |
// | |
// 1. Redistributions of source code must retain the above copyright |
// Swift Standard Librray - String | |
// Keith Harrison http://useyourloaf.com | |
// Import Foundation if you want to bridge to NSString | |
import Foundation | |
// ==== | |
// Initializing a String | |
// ==== |
// Set the popover presentation controller when prepare for segue | |
// The presentation style is set in the storyboard | |
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender | |
{ | |
if ([segue.identifier isEqualToString:@"SeguePopover"]) | |
{ | |
self.featuredPPC = segue.destinationViewController.popoverPresentationController; | |
self.featuredPPC.delegate = self; | |
} | |
} |
I hereby claim:
To claim this, I am signing this object: