Found a bug in my code because of something very subtle:
class C: NSObject {
var foo: String = {
NSLog("non-lazy self: \(self)")
return ""
}()
lazy var bar: String = {
NSLog("lazy self: \(self)")| #!/bin/sh | |
| if git rev-parse --verify HEAD >/dev/null 2>&1; then | |
| against=HEAD | |
| else | |
| # Initial commit: diff against an empty tree object | |
| against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
| fi | |
| exec 1>&2 |
Found a bug in my code because of something very subtle:
class C: NSObject {
var foo: String = {
NSLog("non-lazy self: \(self)")
return ""
}()
lazy var bar: String = {
NSLog("lazy self: \(self)")| Found a bug in my code because of something very subtle: | |
| ``` | |
| class C: NSObject { | |
| var foo: String = { | |
| NSLog("non-lazy self: \(self)") | |
| return "" | |
| }() | |
| lazy var bar: String = { | |
| NSLog("lazy self: \(self)") |
| * TokenScript repo is up | |
| * Main homepage is up | |
| * Verify sig API is up and working | |
| * Check express of trust API is up and working | |
| * Any other API is up | |
| * Any other important site is up |
| 1. Check that in `/token/origins/<ethereum contract="holdingContract">` the string `holdingContract` refers to an existing contract defined in `/token/contract` | |
| ref: https://github.com/AlphaWallet/alpha-wallet-ios/issues/1440 |
| // 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 :) | |
| // Xcode 10.2 to Xcode 11 Beta | |
| sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.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 | |
| import Foundation | |
| import WebKit | |
| final class WebCacheCleaner { | |
| class func clean() { | |
| HTTPCookieStorage.shared.removeCookies(since: Date.distantPast) | |
| print("[WebCacheCleaner] All cookies deleted") | |
| WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in |
| let abi = { | |
| "name" : "balanceOf", | |
| "stateMutability" : "view", | |
| "outputs" : [ | |
| ], | |
| "inputs" : [ | |
| { | |
| "name" : "expiry", | |
| "type" : "uint256" | |
| }, |
JavaScriptCore is a built-in iOS library that enables you to use JavaScript in apps alongside Objective-C and Swift. It lets developers read JavaScript from a string, execute it from Objective-C or Swift, and share data structures and functions across languages. We JavaScriptCore to share code between Web and iOS.
Sharing code helped us produce a high-quality, consistent experience across devices while iterating rapidly.
This post is about why we chose to use JavaScriptCore and what we learned. The biggest challenges to using JavaScriptCore in a production app were performance optimization for older devices and getting the build process right. Luckily, these problems have simple solutions that just weren't documented.
A killer feature of one of our apps is search that is optimized for finding guests by name. Our goals included: