# SwiftUI

**URL:** <https://forum.kirupa.com/t/swiftui/639903>\
**Category:** design\
**Created:** [June 4, 2019, 3:42pm UTC](https://forum.kirupa.com/t/swiftui/639903 "2019-06-04T15:42:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [June 4, 2019, 3:42pm UTC](https://forum.kirupa.com/t/swiftui/639903/1 "2019-06-04T15:42:23Z")

</div>

> **[Xcode - SwiftUI- Apple Developer](https://developer.apple.com/xcode/swiftui/)**
>
> SwiftUI is an innovative, exceptionally simple way to build user interfaces across all Apple platforms with the power of Swift.

This is probably one of the more interesting things to come out for UI development in quite some time. I haven’t played with it outside of reading some tutorials and watching some videos!

🙂

---

<div class="post-metadata">

**Author:** ![prg9](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@prg9](https://forum.kirupa.com/u/prg9)\
**Post date:** [June 4, 2019, 9:15pm UTC](https://forum.kirupa.com/t/swiftui/639903/2 "2019-06-04T21:15:54Z")

</div>

> [@kirupa](#):
>
> This is probably one of the more interesting things to come out for UI development in quite some time.

What aspects or abilities are you most impressed with?

Side note: This was a little amusing “[The preview updates immediately](https://www.youtube.com/watch?v=jbVKwC0tOME&t=17)” followed by loud applause from the crowd? In 2019 people get this excited like preview updates are new or uncommon in development?

---

<div class="post-metadata">

**Author:** ![prg9](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@prg9](https://forum.kirupa.com/u/prg9)\
**Post date:** [June 5, 2019, 9:48pm UTC](https://forum.kirupa.com/t/swiftui/639903/3 "2019-06-05T21:48:35Z")

</div>

> [@prg9](#):
>
> This was a little amusing

Until the video vanished. 🙄

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [June 6, 2019, 3:35am UTC](https://forum.kirupa.com/t/swiftui/639903/4 "2019-06-06T03:35:22Z")

</div>

The simplicity with which you can define the UI. Very few frameworks make defining the UI simple. The closest is Microsoft with XAML.

---

<div class="post-metadata">

**Author:** ![prg9](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@prg9](https://forum.kirupa.com/u/prg9)\
**Post date:** [June 6, 2019, 4:06am UTC](https://forum.kirupa.com/t/swiftui/639903/5 "2019-06-06T04:06:45Z")

</div>

I feel there are many deliveries emerging for this very purpose of easily defining UI to code. But it gets old when in todays marketing approach when every little thing is made to seem so advanced and ground breaking.

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [June 6, 2019, 4:10am UTC](https://forum.kirupa.com/t/swiftui/639903/6 "2019-06-06T04:10:16Z")

</div>

The other part is also how well everything is documented: [https://developer.apple.com/tutorials/swiftui/creating-and-combining-views](https://developer.apple.com/tutorials/swiftui/creating-and-combining-views)

The SwiftUI documentation is probably one of the best of any major language or framework. It’s not surprising at all given that @krilnon and team were behind it 😛

---

<div class="post-metadata">

**Author:** ![prg9](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@prg9](https://forum.kirupa.com/u/prg9)\
**Post date:** [June 6, 2019, 12:53pm UTC](https://forum.kirupa.com/t/swiftui/639903/7 "2019-06-06T12:53:01Z")

</div>

I’m in no way speaking against Swift its an awesome language, but rather speaking in general terms of the industry.

> [@kirupa](#):
>
> It’s not surprising at all given that @krilnon and team were behind it

Cool I never knew that.

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [June 6, 2019, 5:41pm UTC](https://forum.kirupa.com/t/swiftui/639903/8 "2019-06-06T17:41:59Z")

</div>

I totally hear you about the buzzwords around making it easy to build UI that everyone seems to be adopting. The reason why I am more optimistic about SwiftUI is that they control the **language** , **platform** , and the **tools**. That gives them greater flexibility in being more design/developer friendly than something that comes from someone that doesn’t control all three layers. What SwiftUI is doing is more like Flash/Flex than something more disjointed like you might see with Android Studio.

---

<div class="post-metadata">

**Author:** ![prg9](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@prg9](https://forum.kirupa.com/u/prg9)\
**Post date:** [June 6, 2019, 8:38pm UTC](https://forum.kirupa.com/t/swiftui/639903/9 "2019-06-06T20:38:33Z")

</div>

What role does @krilnon play in it all?

Thats true concerning full circle control, Apple has always been good with that even sometimes down to a fault. Maybe a little ironic with the comparison given Apple was prominent in the demise of Flash. 😜

I remember there was even a book out for Actionscript people transitioning to Swift.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 14, 2019, 3:53pm UTC](https://forum.kirupa.com/t/swiftui/639903/10 "2019-08-14T15:53:56Z")

</div>

I saw this thread when it was posted and thought: “Ok, I think I can see what they did there. It’s not too unlike react. And really, couldn’t react also be represented this way?” So I started hacking a little bit to see about having react use a similar syntax. Eventually I gave up. I thought it might be pretty straightforward but it turned out not to be.

[Cut to…] But then yesterday I found my initial attempt and decided to suck it up and follow through with it. Granted, I do not know the ins and outs of SwiftUI. Whats going on in my example here is entirely based on the example syntax shown in that first link.

> **[SwiftUI-React v1 - CodeSandbox](https://codesandbox.io/s/hopeful-fermat-3fe8o)**
>
> The online code editor tailored for web applications

The final react/javascript version code isn’t all that far off from the original. I took some creative liberties in some places but overall I’m happy with how close it got.

Original Swift:

```auto
struct Content : View {
    
    @State var model = Themes.listModel
    
    var body: some View {
        List(model.items, action: model.selectItem) { item in
            Image(item.image)
            VStack(alignment: .leading) {
                Text(item.title)
                Text(item.subtitle)
                    .color(.gray)
            }
        }
    }
}

```

JavaScript/React:

```javascript
const Content = SwiftUI(() => {

    const model = Themes.listModel

    List(model.items, { action: model.selectItem }, item => {
        Image(item.image)
        VStack({ alignment: "leading" }, () => {
            Text(item.title)
            Text(item.subtitle)
                .color("gray")
        })
    })
})

```

Edit: now on github! [https://github.com/senocular/swiftui-react](https://github.com/senocular/swiftui-react)

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [August 15, 2019, 1:54pm UTC](https://forum.kirupa.com/t/swiftui/639903/11 "2019-08-15T13:54:54Z")

</div>

These do look really similar! Nice 🍰

---

<div class="post-metadata">

**Author:** ![prg9](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@prg9](https://forum.kirupa.com/u/prg9)\
**Post date:** [August 15, 2019, 2:20pm UTC](https://forum.kirupa.com/t/swiftui/639903/12 "2019-08-15T14:20:26Z")

</div>

Nice job!

> [@senocular](#):
>
> decided to suck it up and follow through with it.

😥 Imagine all the things laying around on our harddrives etc., that this approach could be applied to. The next great thing is laying somewhere dormant in slumber no doubt. 😄

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 15, 2019, 4:17pm UTC](https://forum.kirupa.com/t/swiftui/639903/13 "2019-08-15T16:17:22Z")

</div>

> [@prg9](#):
>
> 😥 Imagine all the things laying around on our harddrives etc., that this approach could be applied to.

Ooof, I don’t know if the world is ready for that many new Flash projects to hit the streets 🙃

---

<div class="post-metadata">

**Author:** ![prg9](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@prg9](https://forum.kirupa.com/u/prg9)\
**Post date:** [August 16, 2019, 1:27am UTC](https://forum.kirupa.com/t/swiftui/639903/14 "2019-08-16T01:27:35Z")

</div>

> [@senocular](#):
>
> Ooof, I don’t know if the world is ready for that many new Flash projects to hit the streets 🙃

Ha, ha. Well I’m way past those [200 gigs](http://forum.kirupa.com/t/what-happened-to-actionscript-org/481695/14), now its 200+ more of non Flash stuff. 🤪

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [August 16, 2019, 3:03am UTC](https://forum.kirupa.com/t/swiftui/639903/15 "2019-08-16T03:03:32Z")

</div>

Wow! I’m only at around 100mb, but web content doesn’t take up too much space if all I have are emojis and text files 😛

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [August 16, 2019, 5:06am UTC](https://forum.kirupa.com/t/swiftui/639903/16 "2019-08-16T05:06:53Z")

</div>

> [@senocular](#):
>
> I took some creative liberties in some places but overall I’m happy with how close it got.

For obvious reasons I’m not going to say much here; but removing the semicolons was a nice touch!

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 16, 2019, 2:00pm UTC](https://forum.kirupa.com/t/swiftui/639903/17 "2019-08-16T14:00:10Z")

</div>

> [@krilnon](#):
>
> removing the semicolons was a nice touch!

I started without them but when I put them in the codesandbox editor, it added them automatically with its linter/prettier settings (which may be the defaults for create-react-app? not sure). 😛

---

<div class="post-metadata">

**Author:** ![prg9](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@prg9](https://forum.kirupa.com/u/prg9)\
**Post date:** [August 17, 2019, 1:34am UTC](https://forum.kirupa.com/t/swiftui/639903/18 "2019-08-17T01:34:23Z")

</div>

> [@kirupa](#):
>
> all I have are emojis and text files 😛

`¯\_(ツ)_/¯`

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 17, 2019, 6:18pm UTC](https://forum.kirupa.com/t/swiftui/639903/20 "2019-08-17T18:18:27Z")

</div>

> [@prg9](#):
>
> ¯\_(ツ)\_/¯

Plot twist: The emojis _are_ text files!

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [August 17, 2019, 6:58pm UTC](https://forum.kirupa.com/t/swiftui/639903/21 "2019-08-17T18:58:50Z")

</div>

🤯

[Next page](https://forum.kirupa.com/t/swiftui/639903.md?page=2)
