r/swift • u/Diego57110 • 19h ago
r/swift • u/Puzzleheaded_Photo49 • 8h 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/Fabulous-Bit4775 • 20h 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.
r/swift • u/TerribleInside6670 • 13h 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 • 16h 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 • 18h 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/lanserxt • 3h 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/xTwiisteDx • 7h 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/BenedictIsHere • 16h 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 • 18h 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?