Live data from Hacker News

Dictionary and Set Improvements in Swift 4.0

swift.org

21–30 of 71 posts

Re: Dictionary and Set Improvements in Swift 4.0

#21
post #2

I really wish Apple would focus more on getting Xcode up to par. It's in a truly horrid state, both performance and feature-wise. Developing an Objective-C app is worlds ahead of Swift right now.

Are you aware that Xcode 9 just shipped last week and is a major rewrite of much of the IDE? It's one of the largest updates in Xcode's history.

Xcode 9 has been a lot less stable for me compared to previous versions. It will lock-up multiple times per day during simple text editing tasks, with SourceKitService going bananas until I force quit it.

Re: Dictionary and Set Improvements in Swift 4.0

#22

I really wish Swift could find a way to be useful on platforms other than Apple. I'd be willing to commit more to it if I could write truly portable code in it. It's got a good start on Linux, but Windows and Android would be cool too. Though Kotlin won out over Swift for Android (very similar languages but I like Swift a bit better there).

You can use Swift on Windows: https://github.com/apple/swift/blob/master/docs/Windows.md

Re: Dictionary and Set Improvements in Swift 4.0

#23
post #20

Earlier quoted context omitted.

I dunno how true that is, Rust has fantastic support across Windows and Android but leaves UI framework up to the platform.

I think that’s what he’s saying?

Sort-a. I think frameworks are a separable problem with the platform support.

Re: Dictionary and Set Improvements in Swift 4.0

#24
post #2

I really wish Apple would focus more on getting Xcode up to par. It's in a truly horrid state, both performance and feature-wise. Developing an Objective-C app is worlds ahead of Swift right now.

Are you aware that Xcode 9 just shipped last week and is a major rewrite of much of the IDE? It's one of the largest updates in Xcode's history.

XCode 9 is unsurprisingly terrible for me. Between it and the Swift tool chain, they use over 10 gbs of memory and constantly using 100% of my CPU. XCode 9 seems like an improvement over 8 in some cases, but its way less stable, uses an insane amount of resources, and crashes more often.

Re: Dictionary and Set Improvements in Swift 4.0

#25
post #5

The language definitely feels like it has matured as the change from 3.0 to 4.0 was pretty much painless. The big issue with programming in Swift is no longer swift itself but the libraries around it. A lot of the API's you use in day to day Cocoa programming are based on Objective-C and often stringly typed and not very compile safe. For example NSNotificationCenter, setting attributed strings, core data or fetching…

Attributed Strings got better type information in Swift 4 (it got what Notification keys got in Swift 3), but like notifications it's an open-ended API so I don't know what else you can do...

You can't use an enum for the keys because it supports custom attributes (at least you can't without exposing a `.custom(name: String)` case, which would defeat the purpose). And the values can be different types (enums for underline styles, URLs for links, [NS|UI]Color for foreground colors, etc.). I think the `NSAttributedStringKey` box type is a good compromise.

Maybe I'm biased (the Cocoa text system is one of my favorite APIs, and NSAttributedString is at the top), but I'm really happy with the state of attributed strings in Swift 4 myself.

Re: Dictionary and Set Improvements in Swift 4.0

#27
post #10
post #6

Earlier quoted context omitted.

So ... any good?

The only that truly annoyed me was that CMD+click doesn't work immediately anymore but conjures some kind of intermediary menu. Haven't figured out if there's a new keystroke for it, but I'm still doing too much work in Xcode 8. To me it was nothing but progress compared to 8 apart from that. Everything faster and better.

The new key command for it is right there in the menu when it pops up. If you select the first item to do what the old command did, it's literally just to the right of the command!
Post reply on HN