This file contains hidden or 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
    
  
  
    
  | /* | |
| Everyone on Stack Overflow does HTTP Basic Authentication on iOS by manually | |
| building the HTTP headers. | |
| This amounts to re-implementing HTTP. | |
| Why? The Cocoa Touch URL Loading System aleady knows HTTP, and you can | |
| configure your URLSession to supply HTTP Basic Authentication credentials | |
| like so. | 
  
    
      This file contains hidden or 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 | |
| /// Represents side effects needed to sync dst with src | |
| enum Effect { | |
| /// in dst, remove specified item in dst | |
| case remove(dstIndex:Int) | |
| /// in dst, add the specified item from src | |
| case add(srcIndex:Int) | |
| } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | /* | |
| ## background | |
| When you write a function that mutates the var properties of a | |
| mutable struct, this _creates a new instance_.[1] As a result, | |
| a variable pointing to a value of this type before the mutation | |
| will still be pointing to the old value after the mutation, as long | |
| as you did not use that variable to do the mutation. | |
  
    
      This file contains hidden or 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
    
  
  
    
  | // known-good: Swift 3 | |
| import UIKit | |
| /// for a UIView that can be populated via `configure` | |
| protocol ConfigurableView : class { | |
| associatedtype Value | |
| func configure(_ value:Value) | |
| } | |
| /// for a UICollectionViewCell wrapping a UIView | 
  
    
      This file contains hidden or 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
    
  
  
    
  | /** | |
| Generic CollectionViewCell, which can be specialized to wrap a UIView. | |
| To use this, you can simply define a typealias like so: | |
| ``` | |
| class FooView : UIVIew { /* ... */ } | |
| typealias FooCell = WrappedCollectionViewCell<FooView> | |
| ``` | 
  
    
      This file contains hidden or 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 | |
| // known-good: Xcode 8.2.1 | |
| /** | |
| UIImageView subclass which works with Auto Layout to try | |
| to maintain the same aspect ratio as the image it displays. | |
| This is unlike the usual behavior of UIImageView, where the | 
  
    
      This file contains hidden or 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
    
  
  
    
  | // known-good Xcode 8.2.1 | |
| extension URL | |
| { | |
| /** | |
| Returns the data from a URI with the "data:" scheme, which includes the optional "base64" annotation, and which has a mediatype that is encoded in ASCII. As described in https://tools.ietf.org/html/rfc2397. | |
| */ | |
| var asData:Data? | |
| { | |
| guard | |
| let scheme = self.scheme, scheme == "data", | 
  
    
      This file contains hidden or 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 | |
| // machine, version, release, nodename, sysname | |
| extension utsname : CustomStringConvertible { | |
| static var `default`:utsname { | |
| var x = utsname() | |
| uname(&x) | |
| return x | |
| } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | // known-good: Xcode 8.2.1, Swift 3, 2017-02-08 | |
| /** | |
| Draws a circle, centered in the view, with the specified radius | |
| */ | |
| class CircleView: UIView | |
| { | |
| // API | |
| var circleRadius:CGFloat = 15 { | |
| didSet { self.setNeedsLayout() } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <!-- iOS 10, macOS Sierra, and friends bring a new logging subsystem that's | |
| supposed to scale from the kernel, up to frameworks, and up to apps. It defaults | |
| to a more regimented, privacy-focused approach that large apps and complex | |
| systems need. | |
| It, along with Activity Tracing introduced in iOS 8 and macOS Yosemite and the | |
| Console app in macOS Sierra, hope to help you graduate from caveman debugging to |