> So you’ve decided to learn creative coding—smart move. Just know the road isn’t perfectly paved. As you progress, you’ll get stuck, feel confused, and question if this was really a good idea. But don’t worry! This free book will get you unstuck, back on track, and help you reach your destination.
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/Foundation.h> | |
| #import "ffi.h" | |
| NSMutableArray *g_allocations; | |
| ffi_cif g_cif; | |
| ffi_closure *g_closure; | |
| void *g_replacement_invoke; | |
| void *g_origin_invoke; |
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/Foundation.h> | |
| typedef struct __block_impl { | |
| void *isa; | |
| int Flags; | |
| int Reserved; | |
| void *FuncPtr; | |
| }__block_impl; | |
| typedef void(^GlobalBlock)(void); |
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
| START_DATE=$(date +"%s") | |
| SWIFT_LINT=/usr/local/bin/swiftlint | |
| # Run SwiftLint for given filename | |
| run_swiftlint() { | |
| local filename="${1}" | |
| if [[ "${filename##*.}" == "swift" ]]; then | |
| ${SWIFT_LINT} lint --path "${filename}" | |
| fi |
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 trick is to link the DeviceSupport folder from the beta to the stable version. | |
| # sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :) | |
| # Support iOS 15 devices (Xcode 13.0) with Xcode 12.5: | |
| sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
| # Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions | |
| # (A similar approach works for older versions too, just change the version number after DeviceSupport) |
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
| PSPDF_EXTERN BOOL PSPDFIsBlock(id _Nullable block) { | |
| static Class blockClass; | |
| static dispatch_once_t onceToken; | |
| dispatch_once(&onceToken, ^{ | |
| blockClass = [^{} class]; | |
| while ([blockClass superclass] != NSObject.class) { | |
| blockClass = [blockClass superclass]; | |
| } | |
| }); |