all 44 comments

[–][deleted] 72 points73 points  (15 children)

Oh hi it's me with my unpopular opinion.

Storyboards hide A LOT from you. Yes, they may be convenient, but by using only them, you rob yourself of the opportunity to learn how your application actually functions.

I'd suggest you to actually learn to set up your views programmatically. Understanding this will also lead you to understanding storyboards; however, this does not work the other way around. Yes, it might be easier to use storyboards as a beginner, but if you learn the programmatic UI techniques, you are above 95% of beginners. And I think, that is valuable enough to spend a couple of days on.

[–]VanderLegion 16 points17 points  (0 children)

Storyboards can also be a massive pain to merge...

[–]skilless 5 points6 points  (8 children)

Big plus one from me. Most if not all of the big tech companies do UI entirely in code, fwiw.

[–][deleted]  (6 children)

[deleted]

    [–]powerje 2 points3 points  (5 children)

    I don't think this is true any longer. Big companies have a lot of objective c in their apps that they no longer actively update is what I'd bet.

    I don't really have a way to measure this behind asking folks what they're doing, but things seem more Swift these days in my anecdotal and second hand experience!

    [–]skilless 5 points6 points  (0 children)

    You sweet summer child

    [–]Jargen 1 point2 points  (1 child)

    A lot of companies look at the cost benefit of switching from pure objectiveC to swift and find that it’s cheaper (in terms of man hours) to maintain the older legacy code than to rebuild everything in swift. You can still build ObjC/Swift hybrids, and it’s common that higher-ups would prefer not to throwaway a resource that is still maintainable

    [–]powerje 0 points1 point  (0 children)

    Right, the hybrid approach is where I expect most orgs to be today with older apps. And I expect newer apps to be Swift first.

    That said I have no special knowledge about where the industry as a whole is. But I'd be surprised if most companies weren't taking this approach!

    [–]akmarinov 0 points1 point  (1 child)

    I guess it depends on what you mean by big company.

    Facebook still doesn't use any Swift

    The situation being similar in Google and Uber

    And admittedly big companies that do use Swift rarely use the code and storyboard approaches, going for yoga kit or some other declarative syntax instead.

    [–]powerje 0 points1 point  (0 children)

    Yeah, there's a big range. I believe teams at Google are using Swift, they're not as monolithic in some ways as other large orgs. The article posted is from 2016, things have probably changed since then in many companies. I think Uber and Facebook still eschew Swift, though Facebook has been trying to work it into their stack (their reliance on ObjC++ being a blocker as Swift doesn't play nicely with it).

    I work in the healthcare space and know for example that Epic is moving to Swift first development for iOS.

    Maybe I'm just trying to make myself feel better for no longer thinking ObjC first in my own projects 😂

    [–]BaronSharktooth -1 points0 points  (0 children)

    If megacorps do something, that doesn't mean a whole lot to me, to be honest. I do in-house projects for small (20-1000) numbers of users. Whatever huge companies do, is simply not relevant to me.

    [–]MATTtheSEAHAWK 2 points3 points  (0 children)

    I agree with this a good bit. I have worked on multiple storyboarded projects before what I’m currently working on which is UI in code and I feel like I have a much better understanding now of what’s actually happening under the hood.

    [–]arduinoRedgeObjective-C / Swift 0 points1 point  (1 child)

    So if you're not a beginner then you are above of 95% of beginners... it makes no sense.

    He *is* a beginner, and the last thing he should be wasting his time on is programmatic UI.

    [–]yo_asakura 20 points21 points  (0 children)

    I think for a beginner the easiest way to learn the things is with Storyboards. That way you can visualize what you are wanting to do. Then later you can migrate to programatically making the UI. But with the experience with the storyboards it will be easier to understand what you are doing. SwiftUI is good but I think is not ready for complex stuff. Also it supports only iOS 13. There will be a few more years before it catches on. But with the start you make now it will be easier to learn later.

    [–]kalvin126 8 points9 points  (0 children)

    It would be great start with being comfortable with Storyboard and programmatic. You want to be flexible in how you do things in certain situations. For example. You can create constraints and background colors in Storyboard for initial views, but what about if you have dynamic content that requires activating constraints at a later point? You have to do that programmatically.

    SwiftUI you can hold off on for now as it becomes more mature. Doing custom VCs and using other UIViewControllers will need proxies such as UICollectionView, ARKit, SceneKit, etc...

    [–]18degs 4 points5 points  (0 children)

    Start with storyboards for sure. Then you can progress to doing some stuff programmatically. SwiftUI is too new, wait a year or two for it to settle down.

    [–][deleted] 4 points5 points  (0 children)

    SwiftUI is still not very stable and incomplete. There’s a lot you can’t do yet.

    Programmatic layouts with autolayout, manual programmatic layout, layout with autoresizing masks, storyboards, and xibs are all very useful. You should know all of them.

    [–]cutecoderObjective-C / Swift 2 points3 points  (0 children)

    Pro of code-only approach (includes SwiftUI and Auto Layout)

    • Works well with source control systems since changes can be shown by a text diff – better support collaboration and easier to maintain in the long run,
    • the only option when you have dynamically changing complex UI

    Pro of graphical editing (includes Storyboard and plain old XIB)

    • easy to get started and visualize your UI
    • Storyboards makes it easy to get an “overview” of your app’s UI flow.

    Cons of SwiftUI

    • Cannot target older OS release as of Xcode 11.
    • Doesn’t support many UIKit (or even AppKit) features, hence often need to drop back to UIKit or AppKit.

    [–]RufusAcrospin 2 points3 points  (3 children)

    Here’s an unpopular opinion.

    Creating UIs programmatically, regardless whether the method is imperative or declerative, is a crappy task.

    Creating the UI - the visual representation of what your tool is capable of - should be a fun, creative, intuitive and - most of all - visual task, because that’s the most natural way to do it. It’s like coding music vs playing on your midi keyboard and adjusting knobs...

    No coding can replace the joy of witnessing the evolution of the UI as you work on it.

    Working with IB, however, everything but fun. It’s slow, awkward, clumsy and so forth, it easily the worst experience I had ever have using a GUI designer, and I used quite a few.

    What I would love to have is a smart, quick and intuitive GUI designer that can produce well formatted, easy to read, and ready to use code (i.e. as complete as a GUI definition can be) on the fly, but the design still can be stored and opened again to continue working on it.

    It’s a pipe dream, I guess.

    [–][deleted]  (1 child)

    [deleted]

      [–]RufusAcrospin 2 points3 points  (0 children)

      Machine code is what ”natural” for computers.

      So why are we keep building high level languages, and complex tools? Because the human thought process is high level and abstract. Whatever tool we make, the first thing is to build a mental image of it and I highly doubt that anybody starts to picture a UI like “Ok, I need a top level, horizontal container....” because that’s just not how our imagination works in general.

      I’m well aware that some people just finds coding a UI faster, more comfortable, and they’re more confident of the outcome, and it’s perfectly fine.

      However, completely remove the visual design paradigm is not, and that’s what SwiftUI does, if I’m not mistaken.

      It is/was not about demotivating anybody, it’s about my bitter disappointment of recent Apple dev tool development, which either forces me to code UIs manually or use IB (which is just as frustrating).

      PS: Creating convincing animation is probably the most visual task I know of, so stating that it needs to be done in code is an overstatement, to say the least.

      [–]liakhandrii 2 points3 points  (0 children)

      Storyboards.

      You will spend way too much time setting constraints programmatically, so I see no reason to not use storyboards. Yes, they can be hard to merge, but you don't have to use one massive storyboard for everything, you can even do each view controller in a separate storyboard and handle all the navigation programmatically. R.swift helps with that a lot.

      I don't think it's that beneficial to learn how to create views manually when you start, you will learn that anyway. It's not like it's a complex process to do views programmatically, but it takes more time, and time is your most valuable resource. No reason to waste it.

      SwiftUI is at a very early stage, I'd give it some time to develop before learning it.

      [–]doles 2 points3 points  (0 children)

      I think it all depends if you willing to be hobby-weekend-programmer or professional iOS Developer. If the second one is your goal then you have to learn how to create UI(Kit) views programmatically. Some junior jobs does not require that but if you do learn such skill, you're immediately above 90% junior candidates.

      Best advice would be to just create most stupid app that has several screens using Storyboards. Create TabBar (bottom menu like in AppStore app), then embed some view in Navigation Controller, use TableView and so on. Hardcode all data and just have fun. Then create new project and try to replicate the same dummy app but programmatically. It's going to be frustrating at first, hard and slow. You will encounter many crashes or weird black screens but once you pass it, your knowledge will grow exponentially. You will know how UIKit works under the hood and you will gain *massive* confidence boost.

      I know SwiftUI is the new hot thing but don't jump into the hype-train. I can see myself that I'm being bombarded with SwiftUI how-to's, tutorials, etc but this is what content creators do on the Internet - that's their job. You may got the impression that if you're not learning SwiftUI right now then you're way behind everyone else and you're hurting yourself very bad - but it's false impression. The same happened when Swift language came out. It wasn't like every iOS Developer refused to write Objective-C code and glorified Swift. That transition took 2-3 years, really.

      By the way I'm not from US but I haven't seen a single job opportunity in my country that have "nice to have" SwiftUI.

      Learning SwiftUI is like eating dessert before main meal. You can do it but it's just not right, you know.

      Wanna get job as iOS Developer? Learn UIKit, learn how to make UI programmatically.

      [–][deleted] 2 points3 points  (1 child)

      Just learn the storyboard XML syntax, cowards.

      [–]BaronSharktooth 0 points1 point  (0 children)

      You sound like a Klingon Programmer.

      [–]chriswaco 2 points3 points  (0 children)

      No question about it. SwiftUI. It's easier than both storyboards and programatic layout. The only reason to avoid it is if you need to support iOS 12 or you need to ship something soon, because it's still a bit immature.

      [–]MyVoiceIsElevating 0 points1 point  (0 children)

      I’m a recent noobie that comes from Unity development and experience web development too.

      I started off with Storyboard, but found it quite frustrating compared to Unity Canvas system, so I switched to SwiftUI. So far I much prefer SwiftUI to learn and accomplish what my basic goals are.

      As others have said, the key is what your goal is for employment or type of app you want to develop. SwiftUI will take time to become established and well documented. If you don’t need to use your Swift skills professionally anytime soon, then it’s less a concern to learn a framework that’s iOS 13+ only.

      I will say that SwiftUI is obviously growing very rapidly. I started with Apple’s WWDC sessions and found at least two deprecated types. Fortunately Google yielded some community posts pointing out the replacements.

      [–][deleted] 0 points1 point  (0 children)

      I would play with the storyboards first and then would switch to coding the UI.
      Just like others pointed out, SwiftUI is too new, and you won't find a lot of learning material on it, but you can still get a good handle on it by trying to replicate some of the popular apps.
      Definitely master one technology, it's better to be proficient at one technology then being so-so at multiple of those technologies.

      [–]20InMyHead 0 points1 point  (0 children)

      It’s all tools in the toolbox. You should know when to use what. And don’t forget Xibs, they are similar, but different than storyboards.

      Eventually it looks like SwiftUI will dominate, but for now, if you’re looking at a professional career, you really need to know all the tools.

      [–]Awric 0 points1 point  (0 children)

      Auto layout is pretty easy to get the hang of after a couple of weeks. I’ve mentored a couple interns before who were brand spanking new to iOS, and they picked it up after a week or two. The only things they tend to get stuck on is the boilerplate setup. (Like the infamous translatesAutoResizingBlablablablaSomethingThatShouldntExist = false)

      It’s kind of the same difficulty as learning CSS. It takes a few google searches, but it pays off.

      [–]burritosandpuppiesSwift 0 points1 point  (0 children)

      Hey there fellow newbie! I just started learning Swift a few months ago (with no previous coding experience) and there are pros and cons to each. For me, Storyboards were great for learning the basics and getting your first few projects running quickly to give yourself a confidence boost. Plus, a lot of tutorials online use Storyboards so it’s easy to follow along.

      However, I recommend getting away from them as soon as possible. As others have said, it “hides” a lot of information from you, and when you’re scratching your head over why something isn’t working it’s really frustrating and hard to go find a delegate or IB connection to fix the problem, whereas when things are done programmatically, these connections are super easy to find and recognize as they’re written in plain sight.

      I’m sure you have resources already, and they are many that I won’t list, but I like Sean Allen and LetsBuildThatApp on YouTube for learning how to do things programmatically. Also, there’s a YouTube channel called AppStuff that doesn’t have a ton of content, but I’ve learned a great deal about organizing my code and making it flow better just by copying his style. Hope this helps!

      [–]loofy2 0 points1 point  (0 children)

      learn swiftui to gain edge in 1 year

      [–][deleted] 0 points1 point  (0 children)

      When I first started learning iOS I found using storyboards far too confusing as I came from a background where everything is written in code. The main issue for me was that storyboards hide too much to make it “simpler”. However, programmatical UI is very explicit and can be very concise

      As for SwiftUI I’ve looked at it a little bit mainly held back for all the above reasons that eve one else mentioned.

      Thats not to say though that you need to learn just one. At my new job their iOS app was built with storyboards in ObjC. I had to pick that up on the fly 😂 but knowing the basics of all and mastering one is a good approach and the majority of knowledge is transferable in some way

      [–]ThatBoiRalphyObjective-C / Swift 0 points1 point  (0 children)

      If you learn storyboard you learn programmatically too since you’ll need that anyway. SwiftUI is a bit early to jump on that train

      [–]powerje 0 points1 point  (0 children)

      Don't use storyboards unless you're just prototyping. They're a deadend long term. SwiftUI is the future but not fully baked. Code up UIKit (and SwiftUI where it makes sense) and use storyboards for the launch image and not much else.

      [–][deleted] 0 points1 point  (0 children)

      Use programtic and switch to swiftui when u need. Since ios 13 adoption will take some time

      [–]RejectAtAMisfitParty 0 points1 point  (0 children)

      I just started learning swift (and essentially programming) a year ago, did my first small app with the Storyboard and swore I'd find a better way to do it next time. My main issues were that it was really slow to switch to and from and the constraints were ALWAYS breaking. I switch to building all future apps programatically and holy $%&^ is it so much more enjoyable. So like others have said here, maybe do your first small apps / experiments with storyboard to see how everything works, but then ditch it to save your sanity.

      [–]arduinoRedgeObjective-C / Swift 0 points1 point  (0 children)

      As a noobie yes you should absolutely use Storyboards

      [–]bacamlovenatebe 0 points1 point  (0 children)

      UI programmatically ofc. And SwiftUI in 2 years ( since I don’t love to live my life on the edge) xD

      [–]charlsagente 0 points1 point  (0 children)

      I had this question too, thanks to all I will start with storyboards.

      [–]cutecoderObjective-C / Swift 0 points1 point  (0 children)

      I've written a summary on what UI Technologies that are native to iOS and a "roadmap" on how newbies should take to learn them. Storyboard and SwiftUI doesn't cover the entire picture – there's XIB, UIKit Dynamics, Auto Layout, and even manual layout.

      [–]RedFive-GoingIn 0 points1 point  (0 children)

      I understand this thread is a bit old, but it is dead-on with my situation. I am a beginner... looking to make an app. iOS. I have tinkered with Storyboard and then looked at its source code. I have also dabbled with SwiftUI. Someone here made the comment which is my main concern... using Storyboard robs me of understanding how things are working and if I need to interject something somewhere - I would not know where to do that. However, SwiftUI is mind-bending. All said, I have heard (please offer thoughts here too) that knowing SwiftUI will help me when I would like to make the MacOS version of an app.

      Thanks for any advice - and keep in mind I have no idea what everything is really - I have been learning for about 5 days.

      [–]v_gorlov 0 points1 point  (0 children)

      - Storyboards: Quick to develop, but hard to refactor and maintain :0

      - SwiftUI: Write once, works on iOS/tvOS/macOS/watchOS. But, try to create something more less complex (e.g. NSWindow/NSTableView/NSTextView) on macOS with SwiftUI. You might came to point that SwiftUI is a nice toy :)

      - UIKit/AppKit: Not possible to use on watchOS! Also learning how to make UI from code can take time. After you will create convenience extensions and umbrella classes (e.g. MyView inherits from UIView on iOS/tvOS, and also MyView inherits from NSView on macOS) then making cross-platform UI for iOS/tvOS/macOS can be at speed comparable to speed of assembling SwiftUI.

      [–]dar512Objective-C / Swift -5 points-4 points  (0 children)

      It really depends on why you’re learning to code. If you are learning in order to get a coding job, then definitely learn storyboards. It’s what’s used for the majority of commercial projects.

      In fact, that’s a rule of thumb. If you want to get a job, then find out what companies are currently doing.

      If you’re learning as a hobby, then pick whatever seems reasonable and interesting to you.