top | item 27455230

iOS4 Built in SwiftUI

124 points| mattei | 4 years ago |github.com | reply

44 comments

order
[+] thought_alarm|4 years ago|reply
[+] X-Istence|4 years ago|reply
Those screenshots invoke a lot of good memories from when I was in college and hanging out with friends. It's really weird how the design choices stuck with me as a trigger for that.
[+] xattt|4 years ago|reply
The dialpad for the Phone app was absolute perfection.
[+] MrGando|4 years ago|reply
This file is insane: https://github.com/zzanehip/The-OldOS-Project/blob/master/Ol...

I hate to say it but SwiftUI is tricky to write for very complex user interface...the one in that file is a nightmare imo.

[+] lilyball|4 years ago|reply
Really the problem is so much logic is being done inline with the view hierarchy. Like the close button action, it’s a big chunk of code and means I couldn’t even tell it was the close button until I scrolled further down. Actions like that probably should have been pulled off into their own functions.

It could also use actual comments, and perhaps breaking more things putout into subviews.

[+] laszlokorte|4 years ago|reply
I agree that ideally the code could be organized a lot better, but think about it like this:

It is the fully working safari UI in only 1000 lines of code. Additionally the declarative approach of SwiftUI together with the type system makes it certainly correct in many ways: no rendering bugs, no invalid states, probably no memory leaks, no cyclic dependencies creeping in.

Try to build this in Java Swing, UIKit, Html/Css/Js or any other UI library. Flutter might come close, react/vue/svelte as well, if you assume sensible predefined components. But they work similar to SwiftUI and the resulting one-file might look pretty similar.

[+] throwawaywindev|4 years ago|reply
Probably could have made most of the event handlers separate methods rather than lambdas. That would have made the UI structure easier to read. I don’t know Swift or SwiftUI though.
[+] jamil7|4 years ago|reply
It’s fairly poorly abstracted, I guess OP is writing this more for fun. You could hide a lot of this implementation stuff in extensions, view modifiers and by composing views and splitting out event handlers. It isn’t representative of SwiftUI really.
[+] sergiomattei|4 years ago|reply
I have zero experience with SwiftUI but dang, that looks really hard to read.

Reminds me of the PHP4-5 days where we'd have complex logic right within HTML components.

[+] mamp|4 years ago|reply
Very cool project but definitely not best practice. You could reduce the number of State variables using one or more shared state objects and access via environment at certain points in the view hierarchy.

Generally it’s better to compose views, by that I mean you often have to because of the compiler. I’m surprised this file even compiles! The Swift compiler usually chokes on much smaller views.

[+] blacktriangle|4 years ago|reply
I really think SwiftUI is hamstrung by trying to create a DSL that can describe a UI spanning everything from your watch to a desktop. The Apple world is starting to feel more like Google and MS with multiple UI frameworks coming out of different groups and no clear communication on what the long term plan is or expectation from developers. From what I can see though it looks like Catalyst is still very much a thing and I don't think that UIKit is going away anytime soon.
[+] setpatchaddress|4 years ago|reply
Compared to the equivalent standard code to implement that UI?
[+] busymom0|4 years ago|reply
For those who have used both Flutter and SwiftUI, did you ever find that deep nesting to be very ugly and strange?
[+] zaphirplane|4 years ago|reply
The flutter people call this Nesting of layout and logic their secret sauce ! Opinions may vary
[+] todd3834|4 years ago|reply
This is great! While I really do like the flat UI design trend, I sure do miss skeuomorphism in UI design. I underestimated the nostalgia that seeing this original design would stir up in me.
[+] busymom0|4 years ago|reply
I like flat UI design and skeuomorphism too. However I am not a fan of what Apple's doing with half skeuomorphism in the latest MacOS. The new app icons look absolutely hideous. And based on anecdotal comments from others, I am not alone. Also them trying to make the MacOS app icons similar to iPadOS's rounded corner ones made it even worse.
[+] aabbcc1241|4 years ago|reply
Would be nice if it share some screenshots
[+] worg|4 years ago|reply
Adding screenshots would probably get the repo DCMA'ed by Apple for infringing their Copyright
[+] jjice|4 years ago|reply
Wow, this is a throwback to middle school with an iPod touch 2nd gen. I remember when the update allowing custom backgrounds came out, and I don't even know if my device could get it.

I haven't used an Apple mobile product in years (just Mac's for work), but damn did this hit me with some nostalgia.

[+] ngcazz|4 years ago|reply
You could... if you got it jailbroken :)
[+] dlivingston|4 years ago|reply
What I like most about this is how great and intuitive it is as a learning exercise. You have to re-construct the Camera, Maps, Safari, iPod, etc etc etc apps, and to make them functional, you need to call the system APIs for accessing web views / camera readings / etc.

That’s exactly what the author did. It’s like a “learn to build X clone” but for many different X’s.

With that said, he really needs to delete those .DS_Store files scattered everywhere in his repo. Ouch.

[+] ospider|4 years ago|reply
The name should be oldOS, not OldOS.
[+] mysterydip|4 years ago|reply
I may have missed it on the page, but is there a way to run old era apps if you have them in a backup?
[+] swiley|4 years ago|reply
iOS was and always will be a social construct. The ideas of NexTStep pre-date the 90s but certainly weren't new in 2010.
[+] user-the-name|4 years ago|reply
iOS does not have anything to do with NeXTStep beyond sharing a programming language.