499 karma · joined April 28, 2015
Question for the author: perhaps I missed it, but how do you plan to handle view trees that change based on state (ie SwiftUI’s IfElseView + viewbuilder)?
Related thread on Swift forums [1] seems to suggest that the latest Swift compiler would generate code that performs a lot better than the Swift 4.2 version. I'm interested in checking that for myself.
In practice, compiler optimizations reduce the amount of retain/release pairs emitted, but I have no idea how the resulting performance compares to GC languages.
Amazing!
1. Dolby atmos, obviously this is industry standard
2. Head tracking, where sound stays in the same direction despite movement. Introduced last year for the listed headphones, works on some video streaming services. Not supported by Apple Music yet but supposedly coming soon.
I only meant that the head tracking seems specific to apple headphones. If you still feel I’m dull please knock some sense into me.
> Works with AirPods, AirPods Pro, AirPods Max, BeatsX, Beats Solo3 Wireless, Beats Studio3, Powerbeats3 Wireless, Beats Flex, Powerbeats Pro, and Beats Solo Pro.
Am I missing something?
That said, this quote made me laugh out loud
> For example if you're struggling to use Tinder responsibly, you could create a condition that you can only use the app while FaceTiming with a friend.
This could be pretty useful bc of the touch screen + pencil combo. Back in 2016 I spent a weekend mocking up an "iPad as a graphics tablet" app, and it was surprisingly easy and effective [0][1]. I'm sure Apple could do a lot better.
Edit: forgot https://www.objc.io, definitely one of the best
[0]: https://www.hackingwithswift.com
[1]: https://cs193p.sites.stanford.edu
[2]: https://www.raywenderlich.com
[3]: https://www.swiftbysundell.com
Some examples (just going down the readme):
> The observer pattern lets one object observe changes on another object. Apple added language-level support for this pattern in Swift 5.1 with the addition of Publisher in the Combine framework.
- Apple did not add language-level support, the Combine framework is a framework
- NSNotification center was added in iOS 2.0
extension ViewController: ImagePickerDelegate {
func didSelect(image: UIImage?) {
self.yourImageView.image = image
self.dismiss(animated: true, completion: nil)
}
}
> Good To GO- No you're not: what about error handling, permissions, etc.
- There are dozens of libraries for this on Github that do the above and more, why not use them?
func getDocumentDirectoryPath() -> URL {
guard let url = useFileHandler.urls(for: .documentDirectory,
in: .userDomainMask).first else { fatalError("Can't find path") }
return url
}
func createFile(resourceName: String, fileExtension: String) {
let fileURLProject = Bundle.main.path(forResource: resourceName, ofType: fileExtension)
let folderUrl = getDocumentDirectoryPath()
let fileUrl = folderUrl.appendingPathComponent("\(resourceName).\(fileExtension)")
do {
try useFileHandler.copyItem(atPath: fileURLProject ?? "", toPath: fileUrl.path)
} catch {
print(error)
}
}
- You shouldn't fatalError in code intended to be reusable and ready to blindly "copy and paste"- print(error) doesn't exactly inspire confidence
- Again, plenty of libraries exist for this (and Foundation's FileManager isn't that verbose anyway)
struct User: Codable {
var first_name: String
var last_name: String
var country: String
}
- You should use CodingKeys or JSONDecoder.KeyDecodingStrategy instead of snake_case- This section would benefit from a concrete example of JSON<->Codable<->JSON
...and so on. I hope I don't come off too critical here, I just think the author would be better off building something more akin to an Awesome list of links to blog posts, as opposed to a single source of truth of surface-level information where where the bar of knowledge is much higher.
Specifically, actors would alleviate the the mental overhead of constant dispatch queue management littering iOS codebases. Certain UIKit classes would gain @UIActor and suddenly you get a compiler error if you try to modify a view from a background thread. I can’t seem to find any references to that in the current proposal.
Regardless, I’m excited for actors to land in the next release. I’m just concerned adoption will be similar to Swift 3’s do/try/catch syntax, which didn’t take off until UIKit converted all fallible synchronous methods from `(Data?, Error?)` to `throws`.