Live data from Hacker News

SwiftUI

developer.apple.com

131–140 of 394 posts

Re: SwiftUI

#131

Earlier quoted context omitted.

Single-expression functions can now return a value without the “return” keyword: https://github.com/apple/swift-evolution/blob/master/proposa...

Yeah but the example code looks like multiple expressions?

Those might be functions that alter context of the closure rather than being returned. Or it might be some Swift compiler magic?

Re: SwiftUI

#132

Earlier quoted context omitted.

SwiftUI running through Catalyst, surely?

SwiftUI isn't confined to Catalyst. It's available to native Mac AppKit apps as well as UIKit apps. (At least it appears that way, going by the WWDC session descriptions. We'll know more in a couple of hours)

Yeah, or once I can finish unarchiving Xcode…

Re: SwiftUI

#135

Earlier quoted context omitted.

How would you compare this to React.js? In particular, how does SwiftUI approach the concepts that Redux solves [EDIT: in other words, state management]?

https://developer.apple.com/documentation/combine

This looks an awful lot like ReactiveX.

Re: SwiftUI

#136
post #13

Apple developers will be glad they get to rewrite their entire application with a new UI framework and paradigm or risk their apps looking garbage on the platform (and stop working by next release). This must be the .. fifth entirely new UI framework from Apple?

This isn't true at all. Since iOS launched there has been UIKit and then this SwiftUI.

This must be the .. fifth entirely new UI framework from Apple?

This isn't true at all. Since iOS launched there has been UIKit and then this SwiftUI.

They didn't say anything about iOS. There have been lots of UI frameworks from Apple, some abandoned before they were even finished:

QuickDraw, Quickdraw GX, HIToolbox, AppKit, Cocoa Touch/UIKit, Playgrounds/IB, SwiftUI

The constantly changing frameworks and languages are a useful strategy from platform vendors - they do help provide platform lockin, and make it very very difficult to provide cross platform apps. That is a real threat to Apple with offerings like flutter from Google. Of course there are other reasons to make a clean break with the past, but there is a lot of work just to stand still in developing for a platform like Mac OS or IOS - they don't highly value backwards compatibility and often introduce sweeping changes. Constant change is in the platform vendor's financial interest, and I don't think it's unfair to point that out.

Just to take one example - apps built for the original iOS are now almost entirely obsolete, and it's not worth reusing any of their code in a modern swift app.

Re: SwiftUI

#137
post #7

Personally, as an iOS developer, this is by far the biggest announcement. Haven’t had the chance to dig deeper, but the comparison between the UITableViewController and that snippet containing just declarative code looks absolutely promising. The only downside is that we’ll have to wait one or two years before we can use it if older iOS versions still need to be supported. Let’s hope for extra quick adoption of iOS 1…

Unfortunately, iOS 13 drops support for iPhone 5s and iPhone 6.[1] Last year, iOS 12 didn't drop support for any devices. The iPhone 6 is a very popular device, and was still sold by Apple less than two years ago.

[1]: https://iosref.com/ios/

Re: SwiftUI

#138
post #7

Personally, as an iOS developer, this is by far the biggest announcement. Haven’t had the chance to dig deeper, but the comparison between the UITableViewController and that snippet containing just declarative code looks absolutely promising. The only downside is that we’ll have to wait one or two years before we can use it if older iOS versions still need to be supported. Let’s hope for extra quick adoption of iOS 1…

Nah, do what we do on the web: Polyfill. It wouldn't be perfect and have all the interactive tools, but a API-compatible lib that abstracts over AppKit / UIKit seems doable, then just switch imports when the future arrives.

Re: SwiftUI

#139

.color(.gray)) What object is .gray acting on?

That syntax is a shortcut for UIColor.gray, so this is really: .color(UIColor.gray)

I would expect it's the grey static member of SwiftUI's Color struct:

https://developer.apple.com/documentation/swiftui/color/3049...

Post reply on HN