Skip to content

Instantly share code, notes, and snippets.

swift package generate-xcodeproj
echo "go set a codesigning team"
exit 1
xcodebuild archive \
-project swift-composable-architecture.xcodeproj \
-scheme swift-composable-architecture-Package \
-destination "generic/platform=iOS" \
-archivePath "iphoneos" \
@mttcrsp
mttcrsp / AppDelegate.swift
Last active May 4, 2022 20:42
UIApplication.State demo
import UIKit
// case active = 0
// case inactive = 1
// case background = 2
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
@mttcrsp
mttcrsp / ResponderChain.swift
Last active May 4, 2022 20:44
Sample app that demoes events flowing through the responder chain
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = Window()
window?.rootViewController = ViewController()
window?.makeKeyAndVisible()
@mttcrsp
mttcrsp / UITableView+beginRefreshing.swift
Last active February 21, 2021 00:00
Extension that allows programmatic pull to refresh
import UIKit
public extension UITableView {
public func beginRefreshing() {
// Make sure that a refresh control to be shown was actually set on the view
// controller and the it is not already animating. Otherwise there's nothing
// to refresh.
guard let refreshControl = refreshControl, !refreshControl.isRefreshing else {
return