How To sysdiagnose on iOS:
- Hold volume up + volume down + power for 250 milliseconds.
- Wait (up to 5 minutes)
- Settings.app > Privacy > Analytics > Analytics Data
- Select the "sysdiagnose_" file and share via AirDrop to a Mac.
| import Combine | |
| import Foundation | |
| import PlaygroundSupport | |
| struct Reader<E, A> { | |
| let run: (E) -> A | |
| func map<B>(_ fn: @escaping (A) -> B) -> Reader<E, B> { | |
| Reader<E, B> { e in | |
| fn(self.run(e)) | |
| } |
How To sysdiagnose on iOS:
| #!/usr/bin/env bash | |
| # To run at startup: | |
| # sudo defaults write com.apple.loginwindow LoginHook `pwd`/remap.sh | |
| # https://developer.apple.com/library/content/technotes/tn2450/_index.html | |
| CAPS_LOCK="0x700000039" | |
| ESCAPE="0x700000029" | |
| NON_US_BACKSLASH_PLUS_MINUS="0x700000064" | |
| GRAVE_ACCENT_AND_TILDE="0x700000035" | |
| SLASH_PIPE="0x700000031" | |
| ENTER_RETURN="0x700000028" |
A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.
Both UITableView and UICollectionView offer a similar API to register custom cell classes:
public func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)
public func register(_ nib: UINib?, forCellReuseIdentifier identifier: String)| // | |
| // MyMetalWaterfall.swift | |
| // version 0.1.105 (updated for Swift 5) | |
| // | |
| // Demonstrates using a MetalKit compute shader to render a live waterfall RGB bitmap | |
| // into a UIView | |
| // | |
| // This is a single file iOS app | |
| // | |
| // It includes AppDelegate for a minimal demonstration app |
| // We can't use `Character` or `String` ranges directly because they aren't countable | |
| // Create a countable range of ASCII values instead | |
| let range = UInt8(ascii: "a")...UInt8(ascii: "z") // CountableClosedRange<UInt8> | |
| // Convert ASCII codes into Character values | |
| range.map { Character(UnicodeScalar($0)) } // Array<Character> | |
| // → ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] |
| /* You may notice that my CSS file is organized in a fairly straightforward and */ | |
| /* static way. This is intentional, folks. You can do a LOT fancier - but I'm */ | |
| /* operating under a KISS principle here. Otherwise it's too easy to have more */ | |
| /* than one style applying to any line and making troubleshooting difficult. */ | |
| /* My goal is portability and it NEVER distracting from the text. */ | |
| /* Put any additional fonts you REQUIRE here. I recommend using additional fonts */ | |
| /* only when you MUST; and always define a fallback. Please note that if you have */ | |
| /* the font in a sub-directory, you must define it properly in the src portion */ |