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

Does anybody else find themselves unmotivated to learn UIKit?

Forums > 100 Days of Swift

I have already completed 100 days of SwiftUI and now I've decided to try the 100 days of Swift (UIKit Edition). I've only made it through project 3 so far, but it just seems so uninteresting to me.

It seems like most of what we do is draw layouts and change settings in the interface builder more than actually writing code.

When reading the instructions for the next challenge day that I am supposed to complete, Paul even says "Both projects 1 and 2 worked extensively in Interface Builder, which is a running theme in this series" which is super discouraging.

Has anybody else felt like this? Does it get better as the course goes on? Do you feel like you are actually learning to write code eventually? Or is UIKit mostly just using an Interface Builder to do the work for you?

3      

The way SwiftUI works is quiet different from how UIKit works, i had done UIKit earlier and still remember how difficult LayOut was, how i had to write down contraints for View , if i was using the programmatic approach, how the tableView had to be provided with so many data, the delegation system ... Also indeed how massive my ViewController would get ...

SwiftUI streamlines all that , and is definitely the future path, also if one wants to gain any lelvel of proficienecy it is not possible to gain that in both UIKit and SwiftUI at same time, hence i am all in for SwiftUI...

However if you have to do it , for a job opening , then you can surely do it, but it will take time ...

3      

Although, SwiftUI has quite improved since release and many things which are now possible with SwiftUI weren't before iOS16. There are still use cases where you have to rely on a library within the Apple environment which provides only rudimentary support for SwiftUI and you have to fall back to UIKit to get the full functionality.

My advice is: Focus on SwiftUI, it's the future. But eventually you come to a point where you need to use parts of UIKit. It could be a framework which doesn't fully support SwiftUI or you come across some older code which was written before SwiftUI was available. In my opinion a basic understanding of UIKit is necessary.

3      

@Hatsushita - i agree that a basic understanding of UIKit it necessary, but the moment you say that you have a understanding of UIKit , this is what might happen. In a mock interview session , i said i know a little bit of UIKit, now the interviewer asks me immediately,

Q - How will i add Image to UILabel in UIKit

I said - Label("Welcome to the app", image: "star")

Mock Interviewer - this is not correct answer at all ,this will not work for me

I had not clue, then he gave me a link where there was the solution and here it is below in UIKit

let attributedString = NSMutableAttributedString(string: "Your ")

let loveAttachment = NSTextAttachment()
loveAttachment.image = emojisCollection[0]
loveAttachment.bounds = iconsSize
attributedString.appendAttributedString(NSAttributedString(attachment: loveAttachment))

attributedString.appendAttributedString(NSAttributedString(string: " was holdin'\n"))
attributedString.appendAttributedString(NSAttributedString(string: "Ripped "))

let jeansAttachment = NSTextAttachment()
jeansAttachment.image = emojisCollection[1]
jeansAttachment.bounds = iconsSize
attributedString.appendAttributedString(NSAttributedString(attachment: jeansAttachment))

attributedString.appendAttributedString(NSAttributedString(string: " ,\n"))
attributedString.appendAttributedString(NSAttributedString(string: "skin was showin'\n"))

let fireAttachment = NSTextAttachment()
fireAttachment.image = emojisCollection[2]
fireAttachment.bounds = iconsSize
attributedString.appendAttributedString(NSAttributedString(attachment: fireAttachment))

attributedString.appendAttributedString(NSAttributedString(string: " night, wind was "))

let dashAttachment = NSTextAttachment()
dashAttachment.image = emojisCollection[3]
dashAttachment.bounds = iconsSize
attributedString.appendAttributedString(NSAttributedString(attachment: dashAttachment))

attributedString.appendAttributedString(NSAttributedString(string: "\nWhere you think\n"))
attributedString.appendAttributedString(NSAttributedString(string: "you're going, "))

let babyAttachment = NSTextAttachment()
babyAttachment.image = emojisCollection[4]
babyAttachment.bounds = iconsSize
attributedString.appendAttributedString(NSAttributedString(attachment: babyAttachment))

attributedString.appendAttributedString(NSAttributedString(string: " ?"))

label.attributedText = attributedString

So in short if we say we know something , we are expected to be good at it , not just some vague knowledge ... hence i said i am going with SwiftUI , however if someone wants to learn UIKit for job for other critical purpsose , sure , do it ...

3      

Hi @FlyOstrich !

I've been thinking about your concern by myself If I should start to learn UIKit because most probably it will be demanded to know it while applying to first job even now in 2022.

Not long ago I faced Sean Allen's short video on youtube where he says: "I often get the question about which framework is better to learn now. Both is good! but the worst thing you can do is to learn them BOTH SIMULTANEOUSLY ! DON'T DO THAT ! choose one or another and go All-in with it. But dont go with 2 at once"

Considering that Sean is one of the most known Swift YouTubers and seems like a solid engineer I think I would listen to him.

Eventually I ended up with the thought that it makes no sense to dig into UIKit while learning and trying to understand SwiftUI. Cause I'm not even sure I'll succed in last. and UIKit seems even more complicated so there I'd be probably doomed.

  • at least until the moment when you'll get your first job and you will need to know some this or that things about UIKit. then it will be time for it. But it will be much easier to learn it while having a job. Many guys who know it will surround you and I'm sure will be glad to help and explain.

3      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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.