xcode9-beta
Closure tuple does not support destructuring in Xcode 9 Swift 4
Let’s start with the definition of flatMap for a dictionary which is the following: func flatMap(_ transform: (Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult] You see that the transform closure takes only one parameter of type Element where Element is just a typealias for a tuple: public typealias Element = (key: Key, value: Value) So … Read more
Failed to register for BoringSSL log debug updates
UPDATE There’s actually a very convenient way to silence certain logs for a specific simulator: xcrun simctl spawn booted log config –subsystem com.apple.network –category boringssl –mode level:off It is also recommended to silence other common non-important logs as well: xcrun simctl spawn booted log config –subsystem com.apple.CoreBluetooth –mode level:off xcrun simctl spawn booted log config … Read more
Barcode on swift 4
I figured it out but Apple didn’t make it so obvious. The callback function from the delegate AVCaptureMetadataOutputObjectsDelegate has been renamed and the parameter names are different! So, replace func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [Any]!, from connection: AVCaptureConnection!) to func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) My view controller is now … Read more
Simultaneous accesses to 0x1c0a7f0f8, but modification requires exclusive access error on Xcode 9 beta 4
I think this ‘bug’ may be a Swift 4 “feature”, specifically something they call “Exclusive access to Memory”. Check out this WWDC video. Around the 50-minute mark, the long-haired speaker explains it. https://developer.apple.com/videos/play/wwdc2017/402/?time=233 You could try turning the thread sanitizer off in your scheme settings if you’re happy to ignore it. However, the debugger is … Read more
Use the increased navigation-bar title in iOS 11
The only change done to UINavigationBar API for iOS 11 is prefersLargeTitles. Documentation here: https://developer.apple.com/documentation/uikit/uinavigationbar/ You can do it to your own apps with one small change: check “Prefers Large Titles” for your navigation bar in IB, or if you prefer to do it in code using: navigationController?.navigationBar.prefersLargeTitles = true If you need to change … Read more
iOS – Shortcut for jumping to definition in Xcode 9?
Ashish and Ghulam’s answers were great but it still kinda bugged me that things had changed and I couldn’t jump to definition as before. Then I found this… Xcode9Beta2-Preferences->Navigation->Command-click on Code:->Jump To Definition:
Xcode 9 : Module compiled with Swift 3.1 cannot be imported in Swift 4.0
Update: Solution also tested and working in Swift 5 and Xcode 11. Original: I would like to add that if you are using Carthage to compile a module in Swift 3.2 you should go to a terminal and run: sudo xcode-select –switch /Applications/Xcode-beta.app/Contents/Developer To use the Xcode 9 command line tools, then you can run: … Read more
navigation bar rightbaritem image-button bug iOS 11
Reason The problem appears because from ios 11 UIBarButtonItem uses autolayout instead of dealing with frames. Solution You should add width constraint for this image-button if you use Xcode 9. button.widthAnchor.constraint(equalToConstant: 32.0).isActive = true button.heightAnchor.constraint(equalToConstant: 32.0).isActive = true PS button is not UIBarButtonItem, it is UIButton inside UIBarButtonItem. You should set constraint not for UIBarButtonItem, … Read more
How can we use Assets Catalog Color Sets?
UIColor(named: “myColor”) Source: WWDC 2017 Session 237 —— What’s New in MapKit Caveat: Your project’s Deployment Target needs to be set to iOS 11.0.