SwiftUI Are we saying goodbye to IB(UIStoryboard) ?
In WWDC 2019, Apple did announce the launch of SwiftUI, a new Swift framework.
You might think, now thats a sick logo, and you’re probably right, but this is not the only sick thing that comes with SwiftUI.
According to apple, SwiftUI:
A declarative Swift syntax that’s easy to read and natural to write, SwiftUI works seamlessly with new Xcode design tools to keep your code and design perfectly in sync
Well this is a great article to start with, written by Martin Novák .
Now for the big changes some of you are definitely thinking
But sadly the truth is
Ok ok, let’s get back to work, enough with the memes.
Introducing, Xcode 11 beta with the new design tools, oh yes you heard that right, a new design tool .
Xcode 11 includes intuitive new design tools that make building interfaces with SwiftUI as easy as dragging and dropping. As you work in the design canvas, everything you edit is completely in sync with the code in the adjoining editor. Code is instantly visible as a preview as you type, and any change you make to that preview immediately appears in your code.
You might need to install Catalin on your machine to fully use this feature
Now because of the new design tool, and the new declarative paradigm, storyboards are no more part of the workspace file in the new Xcode.
we will be declaring the views programmatically using SwiftUI, and here is an example code of how would it look .
import SwiftUI
struct ContentView: View {
var body: some View { Text(“Turtle Rock”)
.font(.title)
}
} struct ContentView_Preview: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Are we saying goodbye to storyboards once and forever ?
The answer for this is probably yes, but actually this might not come as fast as you might think, it could take up to a year from now to fully release SwiftUI framework out of beta, unless someone at apple reads this and accepts the challenge.
Should i switch now ?
No, usually frameworks at beta are risky and not stable enough for a production application, but you can start learning it now, the sooner it is the better it is .
At the end of the day, we all like to test out new things, don’t hesitate to download Xcode 11 and get your hands dirty with SwiftUI.
If you got this far, thank you for reading hopefully you enjoyed this investigation, if you’re interested in this kind of content please let me know in the comment section and follow me for the next investigation, of the murderer of UIViewControllers .
Note: this is a discussion article i would like to know what you think about my point, and how do you think this will impact us.