alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]
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
| // 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) |
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 | |
| 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 | |
This is a curated list of iOS (Swift & ObjC) frameworks which are inspired by React and Elm.
- ReactSwift by @ColinEberhardt
- https://github.com/ColinEberhardt/ReactSwift
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
| !/bin/sh | |
| SAVEIFS=$IFS | |
| IFS=$(echo -en "\n\b") | |
| FILES=($(git ls-files -m | grep ".*\.swift$" | grep -v ".*R.generated.swift$")) | |
| if [[ ${FILES[@]} ]]; then | |
| export "SCRIPT_INPUT_FILE_COUNT"="${#FILES[@]}" | |
| for i in "${!FILES[@]}"; do | |
| export "SCRIPT_INPUT_FILE_$i"="${FILES[$i]}" | |
| done |
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
| // The issue with sectionHeadersPinToVisibleBounds and sectionFootersPinToVisibleBounds is that they do not pin | |
| // first header and last footer when bouncing. This layout subclass fixes that. | |
| class StickyLayout: UICollectionViewFlowLayout { | |
| override init() { | |
| super.init() | |
| self.sectionFootersPinToVisibleBounds = true | |
| self.sectionHeadersPinToVisibleBounds = true | |
| } |
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 | |
| class OnboardingManager { | |
| private let userDefaults: UserDefaults | |
| init(userDefaults: UserDefaults = .standard) { | |
| self.userDefaults = userDefaults | |
| } | |
| func presentOnboardingControllerIfNeeded(in viewController: UIViewController) { |
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
| let string = "Hello, Playgrounds" | |
| extension String { | |
| func appending(_ other: String) -> String { | |
| return self + other | |
| } | |
| } | |
| let otherString = string.appending("!") | |
| string | |
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
| #define PSPDF_KEYPATH(object, property) (^{ \ | |
| _Pragma("clang diagnostic push") \ | |
| _Pragma("clang diagnostic ignored \"-Wunreachable-code\"") \ | |
| _Pragma("clang diagnostic ignored \"-Wimplicit-retain-self\"") \ | |
| return ((void)(NO && ((void)object.property, NO)), @#property); \ | |
| _Pragma("clang diagnostic pop") \ | |
| }()) |