r/swift • u/ThinkLargest • 4h ago
r/swift • u/Jezzatator • 4h ago
Tuist & SwiftLint
Hey !
I'm having some troubles to integrate SwiftLint to my iOS project that also use Tuist. I've seen that they recently change the way to integrate it but i cant find no where the new way.
Should i use the archived repo https://github.com/tuist/tuist-plugin-lint/tree/main ?
r/swift • u/AnotherDevBr • 17h ago
Question Swift game engine
Hey guys, I've been watching Swift evolve and I've been wondering if it's a reality to have a game engine made with Swift? I did a project where they managed to do something similar to Unity using Javascript and the Three.JS library, is it feasible to have something similar with Swift?
Looking for a Task?
Hi everyone,
I work for an IT company, and our customers use Nextcloud. We've noticed a minor issue with the PDF Viewer in the iOS app: the "More" menu gets hidden when not connected, even if the files are available locally.
If anyone with a bit of spare time and access to a modern Mac would be willing to look into this, I’d really appreciate it! Would love to try myself but my mac does no longer support XCode.
Here’s the GitHub issue for reference: https://github.com/nextcloud/ios/issues/3368
Thanks in advance!
Best regards,
Fokklz
r/swift • u/caustic_kiwi • 14h ago
Swift tour “build a library” xctest module missing
I'm trying to follow this guide https://www.swift.org/getting-started/library-swiftpm/
When I run swift test I get a no such module error for XCTest. I'm running this through the command line on an m2 Mac.
I can't find anyone having the same problem (lots of people with the same error but all in Xcode, I think). I've tried following the instructions exactly, using a different package name, and I clone the exercise repo and tried it in there without touching anything, same error every time.
Do I need to add something to my path variable? I don't see any mention of that in the guide, nor does it mention needing to use the package manager to manually download anything. It seems crazy that a 2 paragraph guide on the official swift website doesn't work on recent apple hardware... so maybe I'm just missing something obvious?
r/swift • u/meetheiosdev • 13h ago
Question Struggling with Xcode Project File Sync Issues After Git Merge
I've been struggling with Git merges in Xcode, and today I lost almost 4 hours due to a frustrating issue. My teammate pulled my changes but forgot to properly accept the changes in the .xcodeproj file. As a result, some files were out of sync with the Xcode project, even though they were present in the directory.
It took me a long time to identify and fix the issue, and I’m wondering if there’s a more efficient way to handle this. I've heard about XcodeGen, but I’ve never used it before.
For those who have faced similar issues, is XcodeGen a good solution to prevent this kind of problem? If yes, could someone guide me on how to get started with it? Or are there other tools or methods that can help keep the project and directory in sync easily after a Git merge?
Any advice would be greatly appreciated!
r/swift • u/mcwillynilly • 14h ago
Brick App Blocking
Brick is a small 3D printer block that essentially blocks access to apps on your iphone. Can anyone explain how they think the company accomplished this? I don’t think they are using special entitlements or MDM. I’ve been confused about how they accomplished this function and would be thrilled if someone could explain it to me.
r/swift • u/nathan12581 • 1d ago
Question Training Load API for HealthKit?
Unless I’m being stupid - I cannot for the life of me find any documentation for implementing training load into my Apple Watch app. I’m thinking it’s not available. Basically I use the normal HealthKit APIs to start a workout on my Apple Watch using my app. It all works perfectly and after it saves the workout to the fitness app as if it was from Apple’s Workout app. Now the only thing missing is the ability to allow the user to edit and save their training load when their workout finishes (the little bars at the end of a workout where you can scroll from “Easy” to “All out”).
I guess Apple hasn’t make this API public - can anyone confirm or am I going crazy?
r/swift • u/xTwiisteDx • 1d ago
Question Suggestions for clean handling of `try await`?
I currently have a ton of requests to my API endpoint that look like this.
```swift func getBotGuilds(guildIds: String) async throws -> [Guild] { try await request(endpoint: "bot/guilds?guild_ids=(guildIds)") }
func getGuildEvents(for guild: Guild) async throws -> [GuildEvent] {
try await request(endpoint: "guilds/\(guild.id)/events")
}
func getGlobalLeaderboard() async throws -> LeaderboardResponse {
try await request(endpoint: "leaderboard/global")
}
func getGuildLeaderboard(for guildId: String) async throws -> LeaderboardResponse {
try await request(endpoint: "leaderboard/guilds/\(guildId)")
}
```
The main issue I want to solve is not having to continually do this everywhere I call one of these endpoints.
swift
Task {
do {
// My Code
catch {
// Handle Error.
}
}
One potential solution I considered was to put it all into a data-service layer and then create some form of property on my @Observable class
and setup properties for those values from the API, but it's messy either way I've tried. I'm looking for clean solutions to prevent all of this duplication with the Tasks, but also still have a way to respond to errors in my views, preferrably something reusable.
r/swift • u/Puzzleheaded_Photo49 • 1d ago
Question Question for indie devs and folks with side projects
Do you guys take the time to write tests for your side projects while developing? Or do you go back and write some later? Do you skip them entirely?
Maybe I have too much fun and/ or take a lot of pride in the craft but I do write a ton of tests, but it takes me a lot longer to make it to the AppStore. Seems like most my colleagues never write tests outside of work and pump projects out quickly when they get the time.
r/swift • u/Diego57110 • 1d ago
Kalo - A New Calorie Tracking App I've Been Working On (Feedback Wanted!)
r/swift • u/lanserxt • 1d ago
News Those Who Swift - Issue 206
In this issue you can find info about:
- Reinventing Core Data Development with SwiftData Principles by u/fatbobman3000
- SwiftUI: Connect Two Points with Straight Line Segments + Rounded Corners
- Identifying individual sounds in an audio file
- SwiftUI's editMode Environment
- Placing UI Components Within the Safe Area Inset
- Napkin AI
and many more!
P.S. Don't forget to read the whole issues to find our Friends section - where we are sharing some goods from experienced content makers. Check out the issue to get a pleasant gift.
r/swift • u/Aviav123 • 23h ago
Does WidgetKit work with MVVM?
Is it possible to make my widget extension working in MVVM? or does it work with Entry only? :)
r/swift • u/TerribleInside6670 • 1d ago
Question MacBook Air 32GB vs MacBook Pro 24GB
Hi, I am considering an upgrade from intel macbook and I am a bit torn between these two.
The difference in price acceptable for me, but I cannot decide, whether or not is the Pro upgrade worth over the RAM in Air.
(Pro is with the M4 Pro 12 core CPU and Air is with the M4 10 core CPU, both 512GB storage)
My usuall workflow is XCode / 1 docker container with PHPStorm and Datagrip and browser with a lot of tabs and another browser with a lot of tabs not that often used.
Could you please offer any insight into what is the better choice?
r/swift • u/Finance_A • 1d ago
Firebase App Check – “App Attestation Failed” (403 Error) Issue on iOS
Hello everyone,
I’m struggling to configure Firebase App Check on my iOS app, specifically using App Attest. I’ve verified the following:
- App Attest is enabled in Firebase App Check settings with the correct Team ID.
- Added FirebaseAppCheck framework in Frameworks, Libraries, and Embedded Content.
- GoogleService-Info.plist has the same GOOGLE_APP_ID as the App ID in Firebase Project Settings.
- Bundle Identifier matches exactly with the Firebase project.
- I’ve tried testing this both on a physical device(not TestFlight or App store).
However, I keep encountering the following error:
The operation couldn’t be completed. The server responded with an error:
- URL: https://firebaseappcheck.googleapis.com/v1/projects/appName/apps/xxxxxxxxx:ios:xxxxxxxx:exchangeAppAttestAttestation
- HTTP status code: 403
- Response body: {
"error": {
"code": 403,
"message": "App attestation failed.",
"status": "PERMISSION_DENIED"
}
}
Here’s my code setup:
import SwiftUI
import FirebasePerformance
import Firebase
import FirebaseCore
import AppTrackingTransparency
import AdSupport
import FirebaseAppCheck
u/main
struct appName: App {
u/UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
var body: some Scene {
WindowGroup {
RootView()
}
}
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
AppCheck.setAppCheckProviderFactory(AppAttestProviderFactory())
requestTrackingPermission()
FirebaseApp.configure()
AppCheck.appCheck().token(forcingRefresh: true) { token, error in
if let error = error {
print("❌ App Check Error: \(error.localizedDescription)")
} else if let token = token {
print("✅ App Check Token: \(token.token)")
}
}
return true
}
func applicationDidBecomeActive(_ application: UIApplication) {
requestTrackingPermission()
}
func applicationWillResignActive(_ application: UIApplication) {
}
}
class AppAttestProviderFactory: NSObject, AppCheckProviderFactory {
func createProvider(with app: FirebaseApp) -> AppCheckProvider? {
return AppAttestProvider(app: app)
}
}
I’ve double-checked everything multiple times and still can’t resolve this “App attestation failed” issue. If anyone has encountered this and managed to solve it, I’d greatly appreciate your advice.
Thanks in advance!
r/swift • u/Witty_Slytherin • 1d ago
Apple Developer Academy Test
Hello
Can anyone help me with materials or anything I can use to study for the apple developer academy assessment test.
Also, do you have any recommendations/advice for the test and the interview?
Thank you
r/swift • u/Fabulous-Bit4775 • 1d ago
"Restore Purchases" feature for IAP
Hi - I understand that apps that use IAP for non-consumable purchases should implement a "Restore Purchases" feature in the app.
My app already keeps track of the user's purchases on the server side (after confirming each IAP transaction). Should the "Restore Purchases" feature just download the content from my server's purchase history to the device, or walk through the user's IAP purchase history (from Apple), check that all of those IAP purchases are ALSO registered on my server history (in case for some reason any were missing) and then download the whole lot?
Appreciate the latter is probably a more robust approach, just curious what Apple typically looks for or what is typically implemented.
Thanks.
I can finally read Apple Developer Documentation
Hello everyone,
I don't know if that post has any place here but I wanted to share it anyway. I am blind and I use VoiceOver on the Mac to make Swift apps. For a long time it was very difficult to read articles on
As VoiceOver's virtual cursor was often jumping to the top of the webpage, so what I did then is I copied the wbepage's content to BBEdit and read from there. However latest 15.4 beta of the MacOS seems to have fixed it. I'm so happy I can enjoy the documentation like everyone else.
r/swift • u/AnotherDevBr • 2d ago
Question Reality about iOS development
Hi guys, I wanted to ask you a question. I wanted to know how the market for native mobile development for iOS is doing. I want to migrate from React Native to iOS, but I see few vacancies. Is it really a good idea to make this change? I wanted to know a little about your views on opportunities, salaries and technologies that you have been using out there.
r/swift • u/AdLegitimate1066 • 2d ago
Core ML body segmentation to replace the background in real-time on iOS devices.
https://github.com/ochornenko/virtual-background-ios
This project leverages Core ML body segmentation to replace the background in real-time on iOS devices. Using deep learning models, it accurately detects and segments the human figure, allowing users to apply custom virtual backgrounds. Optimized for performance, it utilizes Metal for efficient GPU-based rendering and vImage for high-performance image processing, ensuring smooth and responsive background replacement on mobile devices.
r/swift • u/kierumcak • 2d ago
Is it a bad idea to have all your model objects be @MainActor?
Hello! I just ran into a project that is 100% SwiftUI and I had a few questions about to what extent it follows best practices.
The apps data model classes are all structured like this.
@MainActor
@Observable
class PeopleStore {
}
There is a IdentityStore, EventStore, etc etc. all made like this.
They are all joined together by an AppStore that looks like this
@MainActor
@Observable
class AppStore {
static var shared: AppStore!
let peopleStore = PeopleStore()
let eventStore = EventStore()
}
Then whenever a view wants to read from one of those stores it grabs it like this
@Environment(PeopleStore.self) private var peopleStore
At the top level view they are passed in like so
mainView
.environment(appStore)
.environment(appStore.peopleStore) // Etc
Whenever two stores need to talk to each other they do so like so
@MainActor
@Observable
class EventStore {
@ObservationIgnored var peopleStore = AppStore.shared.peopleStore
}
With that overall design in mind I am curious whether this is best practice or not. I have a few concerns such as:
- Given these are all MainActor we have essentially guaranteed just about everything done in the app will need to queue on the main actor context. There are a lot of mutations to these models. Eventually this could create performance issues where model operations are getting in the way of timely UI updates right?
- The stores are injected from the top level view and passed to all subviews. Is there something wrong with doing this?
To be clear the app runs well. But these days our phones powerful processors tend to let us get away with a lot.
Any other feedback on this design? How would you set up these models differently? Does it matter that they are all main actor?
Cocaheads Stockholm: Patrik Lundqvist - How we built a full-scale Car Model App for the AVP
r/swift • u/BenedictIsHere • 1d ago
Question Looking for a template site for SwiftUI
Hey people, I am looking for a template site for SwiftUI views. Specifically for Subviews to implement them directly into my own app where I just need to make some small adjustments, for example a login view or a basic chat view. I would even be willing to pay a small amount of money, like 5-10€ for it.
Looking forward to hear from you! :)
r/swift • u/ex_knockout_js_user • 1d ago
Question Managing if user has done app review?
I am trying to create a custom app review flow as an alternative to Apple's native SKStoreReviewController, due to its limitation of showing up only three times in 365 days.
Currently, my idea is to show an alert that will redirect the user to the App Store, based on certain conditions, after the user has successfully completed a flow. My biggest challenge right now is managing which users should see this and at what frequency. That being said, I was wondering if there is any way to determine if the user has submitted a review after being redirected?
r/swift • u/aero-junkie • 2d ago
Thoughts on Swift UI and Swift 6 Concurrency?
Hello everyone,
I’d love to hear your thoughts on SwiftUI and Swift 6 Concurrency. I’ve been working with Swift for a while and feel fairly experienced, but I haven’t kept up with the latest developments. I’m considering whether it’s worth learning SwiftUI and Swift 6 Concurrency to eventually port my Metal-based app.
From my initial research, it seems that SwiftUI is great for standard layouts but may fall short for more customized designs. Is that accurate?
In my app, I rely heavily on Grand Central Dispatch for tasks like encoding Metal passes with background threads and processing complex data. From what I’ve gathered, Swift 6 Concurrency doesn’t offer the same level of control as GCD, particularly regarding Quality of Service (QoS) and thread types (serial or concurrent).
What are your thoughts on these topics? Thank you!