Discover and read the best of Twitter Threads about #SwiftUI

Most recents (12)

✨✨ SwiftUI tips

Y probably using SwiftUI in iOS 15 by now, here are 10 good practices to make good use of #SwiftUI #iosdev
✨ Take advantage of flexible frames

Sometimes we want to show a button in the corner of the screen and we use VStack, HStack with Spacer.

We can use flexible frame with maxWidth, maxHeight. It is more concise and does not have default spacing like in the stack.
✨ Use overlay with ViewBuilder

Let's say we want to show a star icon to the top right of a book cell.

Before iOS 15, overlay and background modifiers accept only View, so we need to perform logic in Group.

Now we can just specify alignment with content ViewBuilder.
Read 11 tweets
I’m a senior macOS & iOS engineer with:
🖤 12years of Objective-C
🧡 6years of Swift
❤️ 0years of SwiftUI
When I said 0years, it’s 0minutes 🙀🙀🙀

Think it’s time, what are the best resources to start learning? #swiftui
I had a successful way in the past (when moving from Obj-c to Swift) that was to take an idea, and build an app and it worked, so I think I will make an app with SwiftUI 🎉 🎉 🎉
Also, it’s time to give props to people that create content for us. 🙏 thank you @ios_dev_alb for this 👉 iosdevalb.gumroad.com/l/learnandcode…
Read 3 tweets
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.
Read 7 tweets
Alright, this Saturday we’re going to use Swift Playgrounds on iPad to start a ridiculous todo app: ToDon’t: where we add things to NOT DO to your todo list so that you can cross them off & feel more productive.

#iOSDev #SwiftUI #iPad

1/n
Starting with the little todo bit I made from Core Data in Swift Playgrounds here: cephalopod.studio/blog/build-an-…

2/n
One thing I want to do is use the new SectionedFetchResults from Core Data so that my crossed off items go to a different area. Also made my task.name a non-optional string.

And I added a bit of animation and voila!

3/n
Read 20 tweets
Sensei Monitor is getting very close to a public release. I've reworked the design, fixed all the bugs, and optimised performance as much as I can. I'm finally feeling very happy about the state of this feature. [1/12] #SwiftUI #AppKit
It was well over a year ago that I started working on this feature. The first version was built completely in AppKit, and while the potential was there, working with AppKit grew harder and harder. Complex hierarchies and layout led to performance issues and lots of verbose code.
So I completely scrapped it and started over in SwiftUI. This was incredibly painful. I was new to SwiftUI, and I suffered through months of painful learning before I had anything that was even remotely similar to the functionality I had before.
Read 12 tweets
Can your SwiftUI app do this?

Based on the experience we gathered on programmatic navigation in SwiftUI, we decided to build an open source library that enables rich deeplinking and navigation along navigation paths.

Welcome ComposableNavigator! 👋

github.com/Bahn-X/swift-c…
ComposableNavigator is based on a NavigationTree that defines all valid paths in your application. NavigationTree leverages ResultBuilder introduced alongside #SwiftUI to enable a concise DSL for tree building.

#ios #iosdev #mobile #swiftlang #swift
struct AppNavigationTree: NavigationTree {
var builder: some PathBuilder {
Screen(
HomeScreen.self,
content: {
HomeView(viewModel: homeViewModel)
},
nesting: {
DetailScreen.Builder(viewModel: detailViewModel)
}
)
}
}
Read 3 tweets
I've done some #SwiftUI lately for @pushheroapp @PastePalApp , and amazed by how easy and fun it is to make apps. If you want to get into SwiftUI but don't know where to start, here are my recommended resources #iosdev

Thread 👇
1) First thing first is @Apple official guides. Apple has done a stunning job to make SwiftUI tutorials fun and interactive

- Introducing SwiftUI developer.apple.com/tutorials/swif…
- Develop Apps with SwiftUI developer.apple.com/tutorials/app-…
- Creating a macOS App developer.apple.com/tutorials/swif…
2) Next is a mini-series focusing on fundamental blocks which are Stack and ScrollView

- Creating Performant Scrollable Stacks developer.apple.com/documentation/…
- Aligning Views Across Stacks developer.apple.com/documentation/…
- Building Layouts with Stack Views developer.apple.com/documentation/…
Read 18 tweets
Building a Netflix-like app for iOS and iPadOS in #SwiftUI - a thread: Image
Two weeks ago, I wrote about my experience with building a video streaming app for @cineasterna (). The app lets people watch movies for free with their public library card. This thread will discuss how porting that app to a universal #SwiftUI app went.
Just like on tvOS, the iOS and iPadOS app (referred to as iOS from now on) is oriented around four tabs - Discover, All Movies, Search and Profile. If a logged in user has favorites, an additional Favorites tab is added. If no user is logged in, the Profile tab says Login. Image
Read 18 tweets
Fun experiment: since a #swiftui view is just a struct, which is automatically serialisable if its members are, you can — safely! — pull an entire view hierarchy out of JSON. I’m considering using it to communicate with beta testers at some point in the future: Image
Could use HTML instead, but that’s slower to render, less domain-specific. This technique is fully native (fonts, glyphs, dark mode etc), can include custom interactive controls if you want. Can’t send code, only data, so each “item type” needs to be already in the app, but still
It’s simple to extend to support all sorts of layouts/features if you need to, and there’s… like… _nothing_ there — no parsing, almost nothing to write or maintain. Entire demo including test data fits in one screen. Not as general as HTML — but absurd power-to-weight ratio 🙂
Read 3 tweets
Am I right in saying #SwiftUI doesn't really have undo/redo support? It does make an UndoManager available in the Environment, but if you (say) hook up a Toggle, Slider, Picker etc to a binding, it won't support undo/redo and doesn't seem to have any built-in mechanism to do so?
This is my attempt to fill in the gap, but I wouldn't be suprised if there are better ways. If instead of binding a widget to $someItem.someProperty you bind it to UndoableBinding(target: someItem, undoManager: undoManager).someProperty (you can cache this struct & reuse it…) Image
…then undo & redo should work as expected. Surprisingly, sliders don't seem to spam the undo stack with continuous updates, even tho the binding itself updates continuously? This seems to suggest something, somewhere is context-aware, but not sure what...
Read 3 tweets
i'm so bored i started designing a fake stocks app this morning i might build with Swift to learn.

lot of stock apps optimize for density, assume you care about many stocks & require more tapping for basic info. kinda want the opposite: focus on fewer, bigger, one view Image
spent a bit more time today on this. need to figure out:
- stock card anatomy to fit pre/after hours info
- if i want to use Plaid to let people link their brokerage (+ UI to toggle price, positions etc)
- if i want to let people manually enter trades they've done Image
spending this Saturday morning learning how to use Swift Codable to deal with nested JSON using a dynamic key.. not as easy as I thought it would be 😬

Moved a chunk of the code Swift Playground to help debug.. really nice environment with live view and runtime values Image
Read 24 tweets
#swiftkotlin

(Не)-большой тредик о том, какой подход, вероятнее всего, в скором времени приживется в большинстве компаний: от маленьких галер, до больших корпоратов.

Суть подхода заключается в том, что...
#swiftkotlin

Он призван помирить два часто абсолютно зря враждующих друг меж другом лагеря — адептов ведра и овесеров и сплотить их перед единой задачей: написанием единого кода.

Один из его главных плюсов в том, что вкатиться в него проще простого и возможно на любом проекте,
#swiftkotlin

где уже используется swift или kotlin.

Инструментарий и сами подходы к созданию языков дают возможность писать практически полностью интерполируемый друг меж другом код.
Read 41 tweets

Related hashtags

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.00/month or $30.00/year) and get exclusive features!

Become Premium

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

Donate via Paypal Become our Patreon

Thank you for your support!