UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Why are table views so difficult? And autolayout as well?

Forums > Swift

Hi, I know this is probably on some level very flawed questions, I am probably missing something. I was a web developer for a while, and I am studying iOS now. I dont get it, why are views, setting up constraints so hard? Compared to HTML for example. And for love of god, why do I have to setup cells, and register cells and deque a cell etc? Compared to for example placing a div in HTML, that is super easy.

Does that have something to do with memory management? And how on earth can someone build a compex app on iOS if you have to manage so many things? Write so many methods etc? That code has to be insane.

If I just look at an app like Procreate for example, compared to my own super simple apps, I cannot even imagine how that codebase looks like.

2      

I think the reason is that UIKit was created based on the Objective-C programming language, before the people developing UIKit even knew that Swift would come along and make everything easier. So, they were basically taking a language created in the early '80s, and trying to figure out how they could create tools from the Objective-C foundation that would make it easier to make User Interfaces with it in the early '00s.

The people creating Objective-C in the early '80s didn't have the foresight to create the language to be easily used for creating graphical user interfaces, and probably didn't think that it would need to be used for much more than presenting text on screens. So, building this bridge was far from an easy task, and still required using some really messy looking code along the way.

HTML however, was created in the early '90s with a specific goal in mind. (To be able to display pages that could be sent over the internet.) So, they were able to create it in the simplest way that they could think of that would allow a person to accomplish that goal. They didn't have to make it integrate with another 20 year old language.

Not too long after UIKit was released, people probably started to think that there must be a better way, and began development on the Swift programming language. And now we have SwiftUI from it, which makes it possible to condense a lot more into single lines of code. But the developers of Swift and SwiftUI had the advantage of knowing a lot more about what modern day use cases for the language would be, and make it a lot easier for developers to use for those use cases.

2      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.