Khoa 🔥 Profile picture
Apr 11 7 tweets 3 min read
What are some new things you learn about #SwiftUI lately?

Over the course of making several SwiftUI apps, I've discovered quite a few hidden magic of SwiftUI that are quite fun.

Here are 6 interesting SwiftUI features in View Builder many don't know are even possible 🤯
🤯 View protocol with enum

Struct is not the only way to describe #SwiftUI views. Learn how you can achieve the same thing with just enum
🤯 Conform primitive type to View protocol

You can also conform any value type or primitive type to View protocol

The only requirement View needs is to yield a reasonable body.
🤯 Optional view

Optional conforms to View as long as its Wrapped associated value conforms to View.

This means we can provide nil from ViewBuilder block. All the below declarations are valid.
🤯 some keyword is not required

some View is an opaque result type introduced in Swift 5.1 which conforms to View.

If you take a look at View protocol, Body is an associated type.

This means we can specify the return of body function with any concrete type conforming to View
🤯 Make a custom resultBuilder

The some keyword for opaque result type ensures returning a specific concrete type conforming to the protocol.

Returning dynamic Shape to some Shape is not valid. However, we can make our own ShapeBuilder, the same way ViewBuilder does.
🤯 ViewBuilder under the hood

The convenient SwiftUI syntax we have is powered via ViewBuilder, so in a sense we can use ViewBuilder function directly, or declare explicitly with the underlying type like TupleView.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Khoa 🔥

Khoa 🔥 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @onmyway133

Mar 17
Development & design tools for iOS developers #iosdev ⚡️🔥

These are the 33 tools I use daily and have saved me so much time that I can't recommend them enough.
🔥 WTF Auto Layout
Demystify Auto Layout constraint error logs
wtfautolayout.com

🔥 NSDateFormatter
Preview different date formats
nsdateformatter.com

🔥 Quick Type
Convert JSON to Swift code
app.quicktype.io

🔥 Screen Sizes
Device info
screensizes.app
🔥 Cubic Bezier
Play around with bezier path
cubic-bezier.com

🔥 Regex101
Test regular expression
regex101.com
Read 10 tweets
Mar 16
Swift is a very typesafe and expressive language.

With newer features mean we can find new ways to write even more concise Swift code.

Below are 5 sweet techniques that you can use to supercharge your codebase #iosdev 💪🤩
💪 allSatisfy

Instead of using filter and count, you can use allSatisfy to check whether all element satisfies a given condition Image
💪 keyPath

Available since Swift 5.2, keyPath is a type that references a property, allowing us to write much cleaner code.

Given that it is a type, we can store keyPath, pass it around, and combine them. Image
Read 6 tweets
Mar 14
Always want to invest more in your iOS knowledge but don't know where to start?

Here are 7 of the best iOS and SwiftUI courses to subscribe to 👩‍🏫🧑‍🏫

(Disclaimer: I'm not affiliated to any, these are merely based on what I've tried and found useful)
🌼 Hacking With Swift+
by @twostraw

Subscription service that offers exclusive tips and techniques, as well as whole app creation. Some free content are intriguing enough not to miss.

hackingwithswift.com/plus
🌼 Design+Code
by @designcodeio

The content here is top-notch. Get access to premium courses and tutorials, f.e. Build Quick App and Advanced Development with SwiftUI. The content is updated frequently for new SwiftUI versions

designcode.io
Read 8 tweets
Mar 3
I just want to share a list of 8 iOS information websites that have kept me updated during my development career.

I didn't know I need these, but then I bookmarked for use every day ⚡️
⚡️ iOS and iPadOS usage

Official iOS and iPad OS usage statistics by @AppStore measured by devices that transacted recently.

A friendly reminder that 98% of all iOS devices introduced in the last 4 years install iOS 14 and iOS 15 💪

developer.apple.com/support/app-st…
⚡️ Xcode Releases

Updated links and detailed information of all available Xcode versions and their direct DMG link. I've stopped downloading Xcode from AppStore after I found out that the direct link download is more stable.

xcodereleases.com
Read 9 tweets
Mar 2
How do you keep up with iOS development when things are moving quite fast?

To me, it's about reading newsletters 😎

Here are 4 newsletters that I've found insightful over the years ⚡️
📬 @iOSDevWeekly

Do you know when the first issue came out? August 5th 2011!

For over 10 years, @daveverwer has accompanied iOS community and delivered great summaries.

To me, iOSDevWeekly is where all the best and popular resources are mentioned

iosdevweekly.com
📬 iOS Goodies

Started by @peres, @_tiagoalmeida and now maintained by @marius_const, it is an open-sourced where everyone is welcome to submit.

Easily to find essential articles, libraries quickly every issue. Not to mention the good introduction.

ios-goodies.com
Read 5 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(