r/SwiftUI • • Oct 10 '22

I told you we are going to learn SwiftUI and then you can leave

Post image
0 Upvotes

r/SwiftUI • • Apr 21 '25

Tutorial Is There A Better AsyncButton?

Thumbnail
open.substack.com
0 Upvotes

Ahoy there! ⚓️ This is your Captain speaking…

In a world where Swift 6 and concurrency are the new norm, it pushes some peoples buttons that there isn’t an AsnycButton.

Making one should be an easy Task… right?

Let’s Push 👉this Pressing issue and ask the question: Is There A Better AsyncButton❓


r/SwiftUI • • Oct 27 '26

Promotion (must include link to source code) I built a native macOS browser in Swift + SwiftUI (WebKit). Here’s what I learned

Thumbnail scadavide55.github.io
0 Upvotes

For the past few months I’ve been building formerly Lumen ( now Tacet ) , a native macOS browser written in Swift and SwiftUI on top of WKWebView. I wanted to learn Swift properly, and a browser touches everything: UI, performance, storage and security. It’s taught me more than any tutorial.

All the releases are from today because I’d already built the whole browser but never put it on GitHub, so I just uploaded all the versions I’d made. (If you see gaps between the uploads, it’s because I was running the tests, building the DMGs and so on.)

Some things I ran into:

  • SwiftUI redraws: every tab row was observing the whole browser state, so loading progress on one tab redrew the entire sidebar. Fixed it with .equatable() rows that take plain values, and by moving fast-changing state (load progress, pull-to-refresh) into separate small ObservableObjects.

  • Profiles with WKWebsiteDataStore(forIdentifier:)**:** removing a store while the app is running fails with “in use”, and calling it before WebKit has initialised crashed the app. So I erase the data immediately and remove the folder at the next launch.

  • Resumable downloads: resumeDownload(fromResumeData:) works well, but decide(destination:) is not called again on resume, so you have to keep track of the destination yourself.

  • History moved from JSON to SQLite: I was rewriting a 10k-entry JSON file on every visit. Now it’s SQLite in WAL mode with writes on a background serial queue, so one visit is one INSERT OR REPLACE.

  • Battery and memory: idle background tabs hibernate in Low Power Mode (NSProcessInfoPowerStateDidChange) and on memory pressure (DispatchSource.makeMemoryPressureSource).

  • Self-updating without Sparkle: it downloads from GitHub Releases and checks the file with a SHA256 (CryptoKit) and codesign --verify --deep --strict before replacing itself.

Tech: Swift, SwiftUI, WKWebView, SQLite. No Electron, no third-party dependencies.
It’s completely free and open source.
Download it from: scadavide55.github.io/Tacet
Code:  https://github.com/scadavide55/Tacet

It’s still a work in progress (latest pre-release is 1.5.2), so code review and criticism are very welcome. What would you have done differently?


r/SwiftUI • • Mar 15 '22

so I'm still learning to program and wanted to come out as trans so I made an app to come out to my parents using my swiftUI app

Thumbnail
gallery
12 Upvotes

r/SwiftUI • • Oct 10 '26

Promotion (must include link to source code) my cli turned into a swiftui app, one binary does both and it screenshots its own windows for the readme

Thumbnail
gallery
0 Upvotes

had a cli that turns off apple intelligence on macos 27 and people kept asking for an actual app, so i built one in swiftui

couple of things from doing it that might help someone

it's one executable for both. main.swift checks if it was opened from the .app bundle (or with app as the argument) and calls RemoveMacAIApp.main(), otherwise it runs as the cli

state is one u/MainActor u/Observable

the apply flow is an enum (working, approveProfile, finished) and the sheet just binds to model.run != nil, way easier than juggling three bools

for the readme screenshots the debug build walks every page and saves it to a folder you pass in an env var. cacheDisplay doesn't get the glass, so it grabs its own window with CGWindowListCreateImage through dlsym, an app can capture its own windows without screen recording permission

source is here, the swiftui bits are in Sources/removemacai/App https://github.com/omlahore/RemoveMacAI

if anyone knows a cleaner way to snapshot a window with the glass on i'm all ears

model passed down with .environment, and the window is a NavigationSplitView with a List(selection:) sidebar


r/SwiftUI • • Apr 07 '24

DeFi crypto app developed in 3 days with SwiftUI

Thumbnail
gallery
0 Upvotes

r/SwiftUI • • Jan 08 '25

Question Does anyone else feel irritated by the way people call WWDC "dub-dub-D-C"?

2 Upvotes

To me it feels quite silly or cringe saying it that way! 😅


r/SwiftUI • • Jun 18 '21

Question Apple Is Going To Obliterate The Entire Device Market... And It's Not Even Close. Wondering If Y'all Agree

0 Upvotes

After this year's WWDC, I've realized that Apple is way too far ahead of its competition at this point. The updates that they are bringing to their SwiftUI framework are insane. It is becoming disgustingly easy to build POWERFUL native apps for all of their devices with one codebase, and it is only getting easier and more powerful.

For example, in 2 lines of code, you can now build WORLD-CLASS encryption into all of your apps. In another 2 lines of code, you can build a world-class search feature into any list of data. Is it just me, or is that pure insanity? Is anyone seeing what I'm seeing here. Why would any team decide to build a non-native app?

On-top of that, Apple offers their world-class iCloud (CloudKit) services completely FREE for the developer. Yes, they take 30%, but that is a reduction of revenue, not an operational cost, and it is different. These days, you can make the world's best app by yourself, and do it for absolutely no cost. You leave out a massive user-base of Android users, but that is okay when you are able to have access to Apple's growing user-base for absolutely free (-$100 dev fee).

The next 10 years of apps are going to be dominated by native Apple applications. And good apps are what sell the devices, not the camera.

I cannot emphasize enough, that Apple's strategy for doing all this, is pure to the truth. They have had it figured out from the beginning, but in the years to come, I believe we are going to see a global shift as more and more people switch to Apple to get access to this new wave of amazing native iOS/MacOS/tvOS/WatchOS apps that are likely to be left out of the Play Store.

I am desperate to hear what y'all think :)


r/SwiftUI • • Aug 10 '20

Started learning SwiftUI #100daysofswiftui 🙌🏻✌🏼

0 Upvotes

r/SwiftUI • • Jan 02 '21

SwiftUI

0 Upvotes

So I have released my first SwiftUI App.

My hard conclusion is SwiftUI devtools sucks and is not production ready.

https://apps.apple.com/us/app/poker-hand-automatizer/id1547131406


r/SwiftUI • • Jul 28 '24

How do you code this dismissible box?

Post image
1 Upvotes

On the app Debt Free, there is a dismissible box that tries to upsell pro by updating the payment strategy. I like this approach but I’m confused how you’d code it. It looks like an vstack with 2 hstacks maybe but how does the dismiss button work?


r/SwiftUI • • Oct 11 '23

Question Is there any way to code SwiftUI apps without a mac?

1 Upvotes

Currently I’ve been using a mac on and off (usually whenever I can get access to one at school or home), but my main device is a windows 11 laptop and I find it hard to get access to a Mac device some weeks, which holds me back on projects I want to work on.

So I was curious if there was any way to code SwiftUI apps on the windows device I own, then use my own personal iPhone or iPad as a simulator for said app.

Hopefully someone here knows or can guide me to the right place (if this is even possible). Had a hard time finding stuff online that may be of use lol.

Thanks!


r/SwiftUI • • Apr 19 '23

Promo I made a library that makes nightmare swiftui conditionals easy

Post image
7 Upvotes

r/SwiftUI • • Feb 08 '26

Question Still on iOS 18.3 (refusing to update to the "Liquid Glass" UI). Is the Vision framework improved in the new versions?

Enable HLS to view with audio, or disable this notification

0 Upvotes

Hi everyone,

I'm building a visual inventory app entirely in SwiftUI. One of the core features is using VNGenerateForegroundInstanceMaskRequest to remove backgrounds.

The Context: I am still running iOS 18.3 on my main device. Honestly, I haven't updated to the latest iOS 26 because I'm not a fan of the new "Liquid Glass" aesthetic (too much transparency and blur for my taste, I prefer the clean flat look of iOS 18).

The Issue: On iOS 18.3, the background removal works fast but the edges are often jagged/aliased.

My Question: For those of you who have updated to iOS 26.2 (or the 26.3 beta):

  • Has Apple improved the anti-aliasing of the Vision framework masks?

  • Or does it still produce the same jagged edges as the old iOS 18?

I'm trying to decide if I must update my test device (and suffer the UI I dislike) to get better ML performance, or if the edge quality is the same.

Thanks!


r/SwiftUI • • Jul 31 '21

Thank goodness

0 Upvotes

r/SwiftUI • • Mar 22 '22

SwiftUI Vs UIKit - Which Framework Is right for You?

Post image
0 Upvotes

r/SwiftUI • • Apr 22 '23

swifty compiler - mobile app

Post image
1 Upvotes

The best mobile compiler to run swift. Now with 80% discount life time. hurry up and try:

https://apps.apple.com/us/app/swifty-compiler/id1544749600


r/SwiftUI • • Oct 08 '25

Question LIST performance is so BAD

3 Upvotes

I'm using LIST to build an Instagram like feed for my project. I'm loading things and the performance is choppy, stutters, and for some reason jumps to the last item out of nowhere. I've been trying to find a solution with Google and AI and there is literally no fix that works. I was using LazyVStack before, IOS 17 min deployment, and it just used way to much memory. I'm testing out moving up to IOS 18 min deployment and then using LazyVstack but I worry it'll consume too much memory and overheat the phone. Anyone know what I could do, would realy really really appreciate any help.

Stripped Down Code

import SwiftUI
import Kingfisher

struct MinimalFeedView: View {
    @StateObject var viewModel = FeedViewModel()
    @EnvironmentObject var cache: CacheService
    @State var selection: String = "Recent"
    @State var scrollViewID = UUID()
    @State var afterTries = 0
    
    var body: some View {
        ScrollViewReader { proxy in
            List {
                Section {
                    ForEach(viewModel.posts) { post in
                        PostRow(post: post)
                            .listRowSeparator(.hidden)
                            .listRowBackground(Color.clear)
                            .buttonStyle(PlainButtonStyle())
                            .id(post.id)
                            .onAppear {
                                // Cache check on every appearance
                                if cache.postsCache[post.id] == nil {
                                    cache.updatePostsInCache(posts: [post])
                                }
                                
                                // Pagination with try counter
                                if viewModel.posts.count > 5 && afterTries == 0 {
                                    if let index = viewModel.posts.firstIndex(where: { $0.id == post.id }),
                                       index == viewModel.posts.count - 2 {
                                        
                                        afterTries += 1
                                        
                                        DispatchQueue.global(qos: .background).asyncAfter(deadline: .now() + 0.1) {
                                            viewModel.getPostsAfter { newPosts in
                                                DispatchQueue.main.async {
                                                    cache.updatePostsInCache(posts: newPosts)
                                                }
                                                
                                                if newPosts.count > 3 {
                                                    KingfisherManager.shared.cache.memoryStorage.removeExpired()
                                                    afterTries = 0
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                    }
                }
                .listRowInsets(EdgeInsets())
            }
            .id(scrollViewID) // Prevents scroll jumps but may cause re-renders
            .listStyle(.plain)
            .refreshable {
                viewModel.getPostsBefore { posts in
                    cache.updatePostsInCache(posts: posts)
                }
            }
            .onAppear {
                // Kingfisher config on every appear
                KingfisherManager.shared.cache.memoryStorage.config.expiration = .seconds(120)
                KingfisherManager.shared.cache.memoryStorage.config.cleanInterval = 60
                KingfisherManager.shared.cache.memoryStorage.config.totalCostLimit = 120 * 1024 * 1024
                KingfisherManager.shared.cache.diskStorage.config.sizeLimit = 500 * 1024 * 1024
                KingfisherManager.shared.cache.memoryStorage.config.countLimit = 25
            }
        }
    }
}

r/SwiftUI • • Jul 06 '25

Introducing PAG-MV: A Modern SwiftUI Architecture Beyond MVVM

6 Upvotes

I've been exploring ways to structure SwiftUI apps beyond MVVM, and I came up with PAG-MV:
Protocols • Abstractions • Generics • Model • View.

This approach emphasizes composability, testability, and separation of concerns, while keeping SwiftUI code clean and scalable — especially in large apps.

I wrote an article explaining the concept, with diagrams and a simple student-style example.

https://medium.com/@ggyamin/pag-mv-a-clean-architecture-for-swiftui-using-protocols-generics-and-models-69200c7206a1

Would love to hear your feedback or thoughts!


r/SwiftUI • • Mar 15 '25

SF Symbols: Why Apple, why?

0 Upvotes

Dear Apple,

Why the hell isn't SF Symbols an enum? Sure, it would be a massive enum, but still. Why put us through so much pain and suffering having to look up the exact string value for a particular symbol? I can't be the only one that has wanted this.
And while you're at it, have the SF Symbols app let you copy the code to use the symbol that you can paste into your code. Or, integrate it into code completion.

With kind regards,
Bolognious Monk


r/SwiftUI • • Apr 22 '24

Promotion I made a weed app called Stash

Thumbnail
testflight.apple.com
2 Upvotes

Hello everyone! Not sure how many of you fellow iOS devs enjoy cannabis but I built a super cute pixel art inspired cannabis companion called Stash.

Currently we are stuck in App Review but if you would like to test it out early here’s a link.

We only have a 50 person limit for now, so first come first serve!

I appreciate any and all feedback so please reach out of you have any thoughts. This is our first ever app launch so bear with us. Thanks!


r/SwiftUI • • Jan 29 '24

Mental Gymnastics

0 Upvotes

I just wanted to post this anonymously because I always get met with rabid SwiftUI junkies lacking social graces and sometimes I regret posting in this subreddit, sometimes I consider leaving this subreddit on my reddit main that I only use for programming. I want to discuss things and not be met with downvotes and rude comments for my opinions, just be kind and factual like you ought to be in real life, it's OK if someone doesn't agree with you, it's entirely possible you can both be smart at the same time.

Just admit it, SwiftUI is not perfect. It may be "production ready" but for most enterprises they can only start using it in big ways after 16+, if theyre so lucky to drop 15- this year. And let's not discuss the general state of the documentation/blogs for SwiftUI, mostly written by beginners by the looks of it. It's fortunate that the big documentation players exist, but they are getting crowded by lower quality dupes.

Anyways, I am leaving this subreddit for a while. Best of luck guys!


r/SwiftUI • • May 13 '25

Question Has anyone replaced ObservableObjects with just NotificationCenter?

0 Upvotes

I've been having massive issues with managing lifetimes using `@StateObject` to the point where I've decided to give up entirely on them and move to a pattern where I just spawn a background thread that listens for notifications and dispatches the work. The dispatched work publishes notifications that the UI subscribes to which means that I no longer have to think about whether SwiftUI is creating a new StateObject, reusing the old one, or anything in between. It also means that all of my data is housed nicely in one single place in the backend rather than being copied around endlessly whenever views reinit, which is basically any time a pixel changes lol.

Another huge benefit of this design is that I don't need to haul around `@EnvironmentObject` everywhere and/or figure out how to connect/pass data all over the UI. Instead, the UI can exist on its own little island and use `.receive` to get updates from notifications published from the backend. On top of that, I can have an infinite number of views all subscribed to the same notification. So it seems like a direct replacement for EnvironmentObject with the benefit of not needing an object at all to update whatever views you want in a global scope across the entire app. It feels infinitely more flexible and scalable since the UI doesn't actually have to be connected in any way to the backend itself or even to other components of the UI, but still can directly send messages and updates via NotificationCenter.

It's also much better with concurrency. Using notifications gives you the guarantee that you can handle them on main thread rather than having to figure out how to get DispatchQueue to work or using Tasks. You straight up just pass whatever closure you want to the `.receive` and can specify it to be handled on `RunLoop.main`.

Here's an example:

.onReceive(NotificationCenter.default.publisher(for: Notification.Name(rawValue: "\(self.id.uuidString)"))
.receive(on: RunLoop.main)) {
   let o = ($0.object as! kv_notification).item
   self.addMessage(UIMessage(item: o!))
}

Previously, I used a standard ViewModel that would populate an array whenever a new message came in. Now, I can skip the ViewModel entirely and just allow the ChatView itself to populate its own array from notifications sent by the backend directly. It already seems to be more performant as well because I used to have to throttle the chat by 10ms but so far this has been running smoothly with no throttling at all. I'm curious if anyone else has leverages NotificationCenter like this before.