Declarative UI in the middle of a Whirlwind

Declarative UI seems to be the mainstream of the future in mobile programming.

Bram Yeh
1 min readJun 6, 2019

Just as Apple introduces SwiftUI in WWDC 2019, and Google I/O last month develops Jetpack Compose, both dominant platforms offer their declarative toolkit for building UI. (And Google already have another framework, Flutter, that uses Dart to develop declarative UI.)

They are kinds of React, I am sure Jordan Walke will feel very proud.

SwiftUI is the power of Swift, and Jetpack Compose is built with the benefits of Kotlin as well. With the movement towards declarative UI, ObjC and Java will be eliminated faster than I expected before.

SwiftUI

import SwiftUI


struct ContentView: View {
var body: some View {
VStack(alignment: .leading) {
Text("Turtle Rock")
.font(.title)
HStack {
Text("Joshua Tree National Park")
.font(.subheadline)
Spacer()
Text("California")
.font(.subheadline)
}
}
.padding()
}
}


struct ContentView_Preview: PreviewProvider {
static var previews: some View {
ContentView()
}
}

Jetpack Compose

import androidx.compose.*
import androidx.ui.core.*

@Composable
fun Greeting(name: String) {
Text ("Hello $name!")
}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Bram Yeh
Bram Yeh

Written by Bram Yeh

Lead Android & iOS Mobile Engineer at Yahoo (Verizon Media) Taiwan https://www.linkedin.com/in/hanruyeh/

No responses yet

Write a response