Programatic User Interface

Hi Swift Community, I got really interested on making iOS apps. I want to fullfill my dream by creating an IOS app. So I took some courses that uses storyboard and a little bit of coding, but then I saw a profile of an iOS Developer that was doing the user interface programmatically without storyboard. So that grabbed my attention, I am new to programmatically user interface, so when I run the iPhone 5s simulator it looks totally fine but when I run on an iPhone X and above it looks totally different. So my question is what to do? All I know is the constraint program which is " variable.topanchor.constraint(equalto: view.top anchor).isActive = true". By the way if you are an experience programmer in user interface plzz message and give me some tips. (all in swift programming language, not on objective C)

I saw a profile of an iOS Developer that was doing the user interface
programmatically without storyboard

The question of whether to use storyboards (slash nibs) or code to create your UI is much debated in the iOS community. One thing that is clear, however, is that Swift is a great choice for either approach. Given that, your question is unlikely to get much traction here on Swift Forums, where the focus is on the Swift language itself. You might have more luck asking your question somewhere dedicated to UIKit, like the App Frameworks > Cocoa Touch topic area on DevForums.

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

@JoseCool, you can check out some of the example apps that I developed earlier, which is developed using programmatically UI,

you can check out the demo apps and get the gist of programmatically UI. also it is relative fun and easy to build ui programmatically.

also i highly suggest to checkout and use Auto Layout using Visual Format Language and sometimes anchors.

Is It necessary to code the following code “
if #available(iOS 11) “
@satishb

@JoseCool This attribute specifies that function you are using is only available in iOS 11 and greater.

If your application has a minimum version (i.e 10.3) and you are implementing functionality which is introduced in ios 11, in this case, you need to use #available to check for API availability.

check out this for more details
How to use #available to check for API availability - free Swift 5.4 example code and tips,
Availability Attributes in Swift | raywenderlich.com

Makes sense thank you for explaining and providing link for even a better understanding. Can you tell me if I am going on the right track for example, on my post programmatic User Interface using swift, I am using NSLayoutConstraint.active([variable.topAnchor.constraint(equalto: view.topAnchor , constant: 50],
etc(for leftAnchor,rightAnchor)) to handle the auto layout for every iPhone devices in order to make it looks the same on every iOS device, Am i going on the right track? Cause I read an article that says auto layout dynamacally handle the size of the device. @satishb

I wrote a tutorial on programmatic layout: Converting an App from Interface Builder to Programmatic Layout · Race Condition

Thank You, for your programmatic layout tutorial @vermont42