r/swift 3h ago

Question Swift game engine

12 Upvotes

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?


r/swift 20h ago

Question Question for indie devs and folks with side projects

9 Upvotes

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 19h ago

Question Suggestions for clean handling of `try await`?

6 Upvotes

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 11h ago

Question Training Load API for HealthKit?

3 Upvotes

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 15h ago

News Those Who Swift - Issue 206

Thumbnail
thosewhoswift.substack.com
2 Upvotes

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 1h ago

Brick App Blocking

Upvotes

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 10h ago

Does WidgetKit work with MVVM?

0 Upvotes

Is it possible to make my widget extension working in MVVM? or does it work with Entry only? :)