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
| // Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612) | |
| // clang -fmodules -shared -Wall -Os -o libsafariinject.dylib safariinject.m | |
| // | |
| // If SIP off: | |
| // DYLD_INSERT_LIBRARIES=$PWD/libsafariinject.dylib /Applications/Safari.app/Contents/MacOS/Safari | |
| // | |
| // If SIP on, you can demo this by manually removing Safari's code signing signature, but many | |
| // features (eg saved logins) won't be readable by the resigned app: | |
| // cp -a /Applications/Safari.app ./ | |
| // codesign --remove Safari.app/Contents/MacOS/Safari |
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
| // Given an imported C function, that uses a context pointer and a C callback function: | |
| // | |
| // func for_each(_ x: X, context: UnsafeMutableRawPointer!, callback: @convention(c) (UnsafeMutableRawPointer?, Element) -> Void) | |
| // | |
| // When is it safe to use this pattern? | |
| // Example with two captured variables. | |
| typealias Context = (Type1, Type2) | |
| var context = (capture1, capture2) | |
| for_each(x, context: &context) { context, element in |