NSToolbar (Mac API) UIWindowScene.titlebar.toolbar — access
func scene(_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions) {
// setup the windowdefaults read -g
defaults write [com.myapp] [theKey] -date [2019-07-08T17:08:48Z]
Writes 8th of July, 2019, 17:08:48 for theKey for domain com.myapp
Not friends. Even with NSNull. To remove a key-value pair, call
removeObject:forKey:
List of paths, protected by Full Disk Access, on 10.14.5 (Mojave):
/.Spotlight-V100
/Library/Application Support/com.apple.TCC
~/Library/Application Support/MobileSync
~Library/Application Support/CallHistoryTransactions
~Library/Application Support/com.apple.TCC
~Library/Application Support/AddressBook
~Library/Application Support/CallHistoryDB
| namespace Constants | |
| { | |
| // actual global variables | |
| extern const double pi(3.14159); | |
| extern const double avogadro(6.0221413e23); | |
| extern const double my_gravity(9.2); // m/s^2 -- gravity is light on this planet |
| #include <cmath> | |
| // return true if the difference between a and b is less than absEpsilon (a very small number, e.g. 1e-12), or within relEpsilon percent of the larger of a and b | |
| bool approximatelyEqualAbsRel(double a, double b, double absEpsilon, double relEpsilon) | |
| { | |
| // Check if the numbers are really close -- needed when comparing numbers near zero. | |
| double diff = fabs(a - b); | |
| if (diff <= absEpsilon) | |
| return true; | |
| // Otherwise fall back to Knuth's algorithm |
| extension TISInputSource { | |
| var id: String { | |
| let unsafeID = TISGetInputSourceProperty(self, kTISPropertyInputSourceID).assumingMemoryBound(to: CFString.self) | |
| let name = Unmanaged<CFString>.fromOpaque(unsafeID).takeUnretainedValue() | |
| return name as String | |
| } | |
| var type: String { |
| extension String { | |
| /// Remove all whitespaces from the string | |
| mutating func withoutWhitespaces() { | |
| let array = components(separatedBy: .whitespaces) | |
| self = array.joined() | |
| } | |
| /// Check if a string consists only of characters from a specified ChatacterSet | |
| func hasOnly(charsFrom charSet: CharacterSet) -> Bool { | |
| for char in unicodeScalars { |