Running jazzy from a fresh Ubuntu machine:
Create a brand new Ubuntu machine
$ doctl compute droplet create jazzy --size 16gb \
--image ubuntu-16-10-x64 --region sfo1
$ doctl compute ssh jazzy
Install Swift
| // Douglas Hill, December 2018 | |
| // Made for https://douglashill.co/reading-app/ | |
| // Find the latest version of this file at https://github.com/douglashill/KeyboardKit | |
| import UIKit | |
| /// A table view that allows navigation and selection using a hardware keyboard. | |
| /// Only supports a single section. | |
| class KeyboardTableView: UITableView { | |
| // These properties may be set or overridden to provide discoverability titles for key commands. |
| secrets/ |
| extension UICollectionViewFlowLayout { | |
| typealias DelegateMethod<Key, Value> = ((UICollectionView, UICollectionViewLayout, Key) -> Value) | |
| private var delegate: UICollectionViewDelegateFlowLayout? { | |
| return collectionView?.delegate as? UICollectionViewDelegateFlowLayout | |
| } | |
| func retrieve<Key, Value>( |
| import Foundation | |
| public extension Never { | |
| static func gonnaGiveYouUp() -> String { | |
| return "gonna give you up" | |
| } | |
| static func gonnaLetYouDown() -> String { | |
| return "gonna let you down" | |
| } |
| import UIKit | |
| public extension UIStoryboard { | |
| public struct SceneDescriptor { | |
| public let name: UIStoryboard.Name | |
| public let identifier: UIStoryboard.SceneIdentifier | |
| public init(name: UIStoryboard.Name, identifier: UIStoryboard.SceneIdentifier) { | |
| self.name = name |
| // UICollectionView Objective-C example | |
| - (void)viewWillAppear:(BOOL)animated { | |
| [super viewWillAppear:animated]; | |
| NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject]; | |
| if (selectedIndexPath != nil) { | |
| id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator; | |
| if (coordinator != nil) { | |
| [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
Running jazzy from a fresh Ubuntu machine:
Create a brand new Ubuntu machine
$ doctl compute droplet create jazzy --size 16gb \
--image ubuntu-16-10-x64 --region sfo1
$ doctl compute ssh jazzy
Install Swift
| target 'MyTarget' do | |
| use_frameworks! | |
| # Post installation script that enables the Swift 4.2 compiler's | |
| # legacy 4.1 mode for 4.2-incompatible pods | |
| post_install do |installer| | |
| incompatiblePods = ['PodA', 'PodB'] | |
| installer.pods_project.targets.each do |target| | |
| if incompatiblePods.include? target.name |
| // Swift's untyped errors are a goddam PiTA. Here's the pattern I use to try to work around this. | |
| // The goal is basically to try to guarantee that every throwing function in the app throws an | |
| // ApplicationError instead of some unknown error type. We can't actually enforce this statically | |
| // But by following this convention we can simplify error handling | |
| enum ApplicationError: Error, CustomStringConvertible { | |
| // These are application-specific errors that may need special treatment | |
| case specificError1 | |
| case specificError2(SomeType) |
| import Foundation | |
| import UIKit | |
| /// Used to create a layout guide that pins to the top of the keyboard | |
| final class KeyboardLayoutGuide { | |
| private let notificationCenter: NotificationCenter | |
| private let bottomConstraint: NSLayoutConstraint | |