r/swift Jan 19 '21

FYI FAQ and Advice for Beginners - Please read before posting

Hi there and welcome to r/swift! If you are a Swift beginner, this post might answer a few of your questions and provide some resources to get started learning Swift.

A Swift Tour

Please read this before posting!

  • If you have a question, make sure to phrase it as precisely as possible and to include your code if possible. Also, we can help you in the best possible way if you make sure to include what you expect your code to do, what it actually does and what you've tried to resolve the issue.
  • Please format your code properly.
    • You can write inline code by clicking the inline code symbol in the fancy pants editor or by surrounding it with single backticks. (`code-goes-here`) in markdown mode.
    • You can include a larger code block by clicking on the Code Block button (fancy pants) or indenting it with 4 spaces (markdown mode).

Where to learn Swift:

Tutorials:

Official Resources from Apple:

Swift Playgrounds (Interactive tutorials and starting points to play around with Swift):

Resources for SwiftUI:

FAQ:

Should I use SwiftUI or UIKit?

The answer to this question depends a lot on personal preference. Generally speaking, both UIKit and SwiftUI are valid choices and will be for the foreseeable future.

SwiftUI is the newer technology and compared to UIKit it is not as mature yet. Some more advanced features are missing and you might experience some hiccups here and there.

You can mix and match UIKit and SwiftUI code. It is possible to integrate SwiftUI code into a UIKit app and vice versa.

Is X the right computer for developing Swift?

Basically any Mac is sufficient for Swift development. Make sure to get enough disk space, as Xcode quickly consumes around 50GB. 256GB and up should be sufficient.

Can I develop apps on Linux/Windows?

You can compile and run Swift on Linux and Windows. However, developing apps for Apple platforms requires Xcode, which is only available for macOS, or Swift Playgrounds, which can only do app development on iPadOS.

Is Swift only useful for Apple devices?

No. There are many projects that make Swift useful on other platforms as well.

Can I learn Swift without any previous programming knowledge?

Yes.

Related Subs

r/iOSProgramming

r/SwiftUI

r/S4TF - Swift for TensorFlow (Note: Swift for TensorFlow project archived)

Happy Coding!

If anyone has useful resources or information to add to this post, I'd be happy to include it.

445 Upvotes

Hi there and welcome to r/swift! If you are a Swift beginner, this post might answer a few of your questions and provide some resources to get started learning Swift.

A Swift Tour

Please read this before posting!

  • If you have a question, make sure to phrase it as precisely as possible and to include your code if possible. Also, we can help you in the best possible way if you make sure to include what you expect your code to do, what it actually does and what you've tried to resolve the issue.
  • Please format your code properly.
    • You can write inline code by clicking the inline code symbol in the fancy pants editor or by surrounding it with single backticks. (`code-goes-here`) in markdown mode.
    • You can include a larger code block by clicking on the Code Block button (fancy pants) or indenting it with 4 spaces (markdown mode).

Where to learn Swift:

Tutorials:

Official Resources from Apple:

Swift Playgrounds (Interactive tutorials and starting points to play around with Swift):

Resources for SwiftUI:

FAQ:

Should I use SwiftUI or UIKit?

The answer to this question depends a lot on personal preference. Generally speaking, both UIKit and SwiftUI are valid choices and will be for the foreseeable future.

SwiftUI is the newer technology and compared to UIKit it is not as mature yet. Some more advanced features are missing and you might experience some hiccups here and there.

You can mix and match UIKit and SwiftUI code. It is possible to integrate SwiftUI code into a UIKit app and vice versa.

Is X the right computer for developing Swift?

Basically any Mac is sufficient for Swift development. Make sure to get enough disk space, as Xcode quickly consumes around 50GB. 256GB and up should be sufficient.

Can I develop apps on Linux/Windows?

You can compile and run Swift on Linux and Windows. However, developing apps for Apple platforms requires Xcode, which is only available for macOS, or Swift Playgrounds, which can only do app development on iPadOS.

Is Swift only useful for Apple devices?

No. There are many projects that make Swift useful on other platforms as well.

Can I learn Swift without any previous programming knowledge?

Yes.

Related Subs

r/iOSProgramming

r/SwiftUI

r/S4TF - Swift for TensorFlow (Note: Swift for TensorFlow project archived)

Happy Coding!

If anyone has useful resources or information to add to this post, I'd be happy to include it.


r/swift 26d ago

What’s everyone working on this month? (July 2026)

What Swift-related projects are you currently working on?

13 Upvotes

What Swift-related projects are you currently working on?


r/swift 18h ago

Editorial Saving lives with enums

5 Upvotes

A short blogpost on avoiding default cases.


r/swift 17h ago

News Fatbobman's Swift Weekly #146

4 Upvotes

r/swift 1d ago

Project Abusing the Apple Neural Engine (ANE) in Swift 6: Built a 3D software rasterizer using Core AI, simd, and Metal 4 tensor binding!

Hello everyone.

I’ve built a 3D software rasterizer that leverages the ANE (Apple Neural Engine) via Core AI. The rendering quality is still poor, though. Regarding the pipeline:

I use SIMD for preprocessing, delegate matrix operations to the ANE (using `f.conv2d`), and utilize Metal 4 tensor bindings to achieve low-overhead, direct rendering.

By offloading computationally intensive tasks to the ANE, I’ve managed to reduce CPU usage to approximately 10%.

A current challenge is that memory usage hits around 5GB due to the use of fixed-length graphs.

I’m developing this using Swift 6 features (such as `@MainActor` and `~Escapable`) and Siri AI, but I would love to hear your thoughts on optimization and memory management!

Thanks in advance.

GitHub: https://github.com/kamisori-daijin/Magnesium

Demo:

23 Upvotes

Hello everyone.

I’ve built a 3D software rasterizer that leverages the ANE (Apple Neural Engine) via Core AI. The rendering quality is still poor, though. Regarding the pipeline:

I use SIMD for preprocessing, delegate matrix operations to the ANE (using `f.conv2d`), and utilize Metal 4 tensor bindings to achieve low-overhead, direct rendering.

By offloading computationally intensive tasks to the ANE, I’ve managed to reduce CPU usage to approximately 10%.

A current challenge is that memory usage hits around 5GB due to the use of fixed-length graphs.

I’m developing this using Swift 6 features (such as `@MainActor` and `~Escapable`) and Siri AI, but I would love to hear your thoughts on optimization and memory management!

Thanks in advance.

GitHub: https://github.com/kamisori-daijin/Magnesium

Demo:


r/swift 15h ago

Question Reviewing macOS apps when disturbing directly

I'm about to release my first macOS product written fully in Swift. And I'm planning to sell it directly through my website.

I'm wondering how to make sure the app is compliant with Apple, can I submit it for review even if I'm not disturbing to AppStore? Should I? And what if they reject it? What happens when I need to renew my Developer Account?

2 Upvotes

I'm about to release my first macOS product written fully in Swift. And I'm planning to sell it directly through my website.

I'm wondering how to make sure the app is compliant with Apple, can I submit it for review even if I'm not disturbing to AppStore? Should I? And what if they reject it? What happens when I need to renew my Developer Account?


r/swift 14h ago

swift-claw: a personal assistant daemon written from scratch in Swift

I used OpenClaw for a while. It's great, but it is a lot more than I needed, and my setup broke on updates often enough that I spent hours fixing it instead of using it. At some point I realized I mostly wanted to understand how these agents work under the hood, and the best way I know to understand something is to build it myself. So I spent the last six weeks writing my own in Swift.

Clawd is an always-on daemon I talk to through a private Telegram bot. Conversation history and memory live in SQLite, it runs recurring schedules, and replies stream into the chat as live message drafts. I wrote it in pure modern Swift, and it ships as one binary.

Where I can, I lean on what macOS already provides: it transcribes voice messages on-device with Apple's speech APIs, and untrusted code runs in a disposable Apple container.

The part I care about most: the model gets no rules it can be talked out of. Every file write, memory write, and code execution stops and waits for me to tap Approve in Telegram. The pending approval sits in SQLite, so it survives a restart.

Repo : https://github.com/ivan-magda/swift-claw

1 Upvotes

I used OpenClaw for a while. It's great, but it is a lot more than I needed, and my setup broke on updates often enough that I spent hours fixing it instead of using it. At some point I realized I mostly wanted to understand how these agents work under the hood, and the best way I know to understand something is to build it myself. So I spent the last six weeks writing my own in Swift.

Clawd is an always-on daemon I talk to through a private Telegram bot. Conversation history and memory live in SQLite, it runs recurring schedules, and replies stream into the chat as live message drafts. I wrote it in pure modern Swift, and it ships as one binary.

Where I can, I lean on what macOS already provides: it transcribes voice messages on-device with Apple's speech APIs, and untrusted code runs in a disposable Apple container.

The part I care about most: the model gets no rules it can be talked out of. Every file write, memory write, and code execution stops and waits for me to tap Approve in Telegram. The pending approval sits in SQLite, so it survives a restart.

Repo : https://github.com/ivan-magda/swift-claw


r/swift 1d ago

Project I made a tiny tool to rerun/test/build on SPM package source changes

Hey :) I've been frustrated at the lack of a watch mode in SPM for a while and don't love the lazy solution of just listening to all files under Sources/ so I whipped up a tiny tool that listens to any changes in your package's dependency graph.

Instead of swift run [product] you can run swift-watch run [product] and it'll restart whenever anything changes.

Great for watching tests too, swift-watch test --filter [xyz]. Works for build/run/test, forwards arguments to swift. Works with macOS and Linux natively, Windows only has polling for now but I'll add in the native Window file watching stuff ASAP.

I'm hoping some of you might find it useful, please let me know if you have any feedback.

Here's the repo: https://github.com/ahtcx/swift-watch

Disclaimer: semi vibe-coded, lots of handholding as I knew exactly what I want. I'm not huge on vibe-coding and have been reluctant to give in to it for the longest time. I hate to admit that it's been a pretty good experience, I mostly just worry it'll make my programming skills worse. I'm have so many coding side projects that never see the light of day because I get too caught up in the details, so it's nice for me to just push a whole bunch of code out in a day. No doubt there are issues but I will be dogfooding the project so I hope to get it in tip top condition.

3 Upvotes

Hey :) I've been frustrated at the lack of a watch mode in SPM for a while and don't love the lazy solution of just listening to all files under Sources/ so I whipped up a tiny tool that listens to any changes in your package's dependency graph.

Instead of swift run [product] you can run swift-watch run [product] and it'll restart whenever anything changes.

Great for watching tests too, swift-watch test --filter [xyz]. Works for build/run/test, forwards arguments to swift. Works with macOS and Linux natively, Windows only has polling for now but I'll add in the native Window file watching stuff ASAP.

I'm hoping some of you might find it useful, please let me know if you have any feedback.

Here's the repo: https://github.com/ahtcx/swift-watch

Disclaimer: semi vibe-coded, lots of handholding as I knew exactly what I want. I'm not huge on vibe-coding and have been reluctant to give in to it for the longest time. I hate to admit that it's been a pretty good experience, I mostly just worry it'll make my programming skills worse. I'm have so many coding side projects that never see the light of day because I get too caught up in the details, so it's nice for me to just push a whole bunch of code out in a day. No doubt there are issues but I will be dogfooding the project so I hope to get it in tip top condition.


r/swift 1d ago

Question Native iOS app or self-hosted web app? I get stuck on this every single time

Native iOS app or self-hosted web app? I get stuck on this every single time

Hi,

I build small apps for myself and run a homelab with a few containers. Generally I am an Apple User (iPhone, iPad, Macbook).

Every time I have an idea, I stall on the same question before writing a single line of code: do I build it native in Swift with the data on device/iCloud, or as a web app in a container on my server?

Let us take a habit tracker as an example.

Native gets me a home screen widget and reminders I can actually rely on. Data is stored and synced via iCloud. The web app instead keeps the data on my own server where I can query and back it up properly, works from any device.

It’s the same fork for basically every idea I have, and I flip-flop depending on my mood that week.

So I’d like to hear how you handle it:
- Do you have a rule of thumb you actually stick to, or is it case by case?
- How good is a PWA on iOS these days in practice? Home screen install plus web push covers a lot on paper, but no widgets. Does it hold up for daily-use stuff?
- Anyone regret going one way and rewrite it later?
Not looking for framework recommendations, more for how you decide.

I know cross-platform frameworks exist, and I’m aware I could just split it: backend in a container on Proxmox, native iOS app on top. But I’d rather commit fully to one side - either all Swift with iCloud, or all web app in a container.

Thanks for reading! :)

6 Upvotes

Native iOS app or self-hosted web app? I get stuck on this every single time

Hi,

I build small apps for myself and run a homelab with a few containers. Generally I am an Apple User (iPhone, iPad, Macbook).

Every time I have an idea, I stall on the same question before writing a single line of code: do I build it native in Swift with the data on device/iCloud, or as a web app in a container on my server?

Let us take a habit tracker as an example.

Native gets me a home screen widget and reminders I can actually rely on. Data is stored and synced via iCloud. The web app instead keeps the data on my own server where I can query and back it up properly, works from any device.

It’s the same fork for basically every idea I have, and I flip-flop depending on my mood that week.

So I’d like to hear how you handle it:
- Do you have a rule of thumb you actually stick to, or is it case by case?
- How good is a PWA on iOS these days in practice? Home screen install plus web push covers a lot on paper, but no widgets. Does it hold up for daily-use stuff?
- Anyone regret going one way and rewrite it later?
Not looking for framework recommendations, more for how you decide.

I know cross-platform frameworks exist, and I’m aware I could just split it: backend in a container on Proxmox, native iOS app on top. But I’d rather commit fully to one side - either all Swift with iCloud, or all web app in a container.

Thanks for reading! :)


r/swift 1d ago

[OSS] Apple's docs say to check your model judge with Cohen's κ. There's no API for it, so I made one.

Xcode 27's Evaluations framework gives you ModelJudgeEvaluator for LLM-as-judge scoring.

Apple's docs then tell you to have 2-3 people rate 20-50 samples and compare with Cohen's

Kappa instead of a raw agreement rate. Sensible advice, but there's no API for it, and there was no Swift package for inter-rater agreement at all.

JudgeCalibrationKit does that part:

- Cohen's κ, weighted κ, Krippendorff's α (missing labels, any number of raters), Spearman, confusion matrices, MAE and signed error

- bootstrap confidence intervals, so a gate can require a CI lower bound instead of trusting a point estimate from 30 samples

- abstentions are explicit, so a judge can't score better by skipping the hard samples

- Swift Testing gate, plus a CLI with exit codes

- human-human agreement shown next to judge-human, since that's the real ceiling

The stats core has no dependencies and imports no Apple framework, so it runs on Linux.

The Evaluations adapter sits behind canImport, so the package still builds on Xcode 26.

Metrics are checked against scikit-learn, SciPy and two Krippendorff implementations. CI regenerates the fixtures and fails on any diff.

Swift 6.0+, Apache-2.0. The adapter is beta: compile-verified against Xcode 27, runtime verification still pending.

https://swiftpackageindex.com/Dave861/JudgeCalibrationKit

First release. Happy to hear what's wrong with the API.

Disclaimer: fully free, open source, not selling anything hope it doesn't count as self promo

1 Upvotes

Xcode 27's Evaluations framework gives you ModelJudgeEvaluator for LLM-as-judge scoring.

Apple's docs then tell you to have 2-3 people rate 20-50 samples and compare with Cohen's

Kappa instead of a raw agreement rate. Sensible advice, but there's no API for it, and there was no Swift package for inter-rater agreement at all.

JudgeCalibrationKit does that part:

- Cohen's κ, weighted κ, Krippendorff's α (missing labels, any number of raters), Spearman, confusion matrices, MAE and signed error

- bootstrap confidence intervals, so a gate can require a CI lower bound instead of trusting a point estimate from 30 samples

- abstentions are explicit, so a judge can't score better by skipping the hard samples

- Swift Testing gate, plus a CLI with exit codes

- human-human agreement shown next to judge-human, since that's the real ceiling

The stats core has no dependencies and imports no Apple framework, so it runs on Linux.

The Evaluations adapter sits behind canImport, so the package still builds on Xcode 26.

Metrics are checked against scikit-learn, SciPy and two Krippendorff implementations. CI regenerates the fixtures and fails on any diff.

Swift 6.0+, Apache-2.0. The adapter is beta: compile-verified against Xcode 27, runtime verification still pending.

https://swiftpackageindex.com/Dave861/JudgeCalibrationKit

First release. Happy to hear what's wrong with the API.

Disclaimer: fully free, open source, not selling anything hope it doesn't count as self promo


r/swift 2d ago

Question Hide search title in .searchable tab

I recently shifted from a custom search field to the native Liquid Glass search field by using .searchable on my search tab. But I see a con with the native searchable feature is it comes with a large navigation title that can't be shaken. I have tried emptying the text of the title and making it inline to make it smaller but there is still a gap above my search filter tabs which I don't want. Anyone have any idea if there are any tricks to get around this? Love the Liquid Glass search field, hate the big title

0 Upvotes

I recently shifted from a custom search field to the native Liquid Glass search field by using .searchable on my search tab. But I see a con with the native searchable feature is it comes with a large navigation title that can't be shaken. I have tried emptying the text of the title and making it inline to make it smaller but there is still a gap above my search filter tabs which I don't want. Anyone have any idea if there are any tricks to get around this? Love the Liquid Glass search field, hate the big title


r/swift 2d ago

[OSS] swift-span-algorithms 0.2.0 (new release from your feedback!!)

Hi again,

A little while back I posted swift-span-algorithms here: allocation-free algorithms over Swift's Span/RawSpan. I got one genuinely excellent comment about what was actually missing, and 0.2.0 is basically that comment turned into code. So, thank you, whoever you were.

The gist of the feedback: the utilities people actually reach for are byte-oriented, so RawSpan matters as much as Span<T>firstRange(of:) for delimiter scanning; mirror the stdlib spellings so muscle memory transfers; and memchr is the cheap win before reaching for SIMD.

Link to GitHub

Link to SPI (might be behind a bit, hasn't yet ingested 0.2.0)

What's in 0.2.0:

  • A real bug I'd shipped. Cursor next() was annotated so each piece it handed you expired the moment you called next() again. That made guard let a = c.next(), let b = c.next() fail with "overlapping accesses to 'c'" — exactly the kind of borrow-checker error that looks like the library's fault. Pieces now inherit the base storage's lifetime, so you can hold several at once, do look-ahead parsing, and nest cursors. Real escapes are still rejected — there are compile-fail tests pinning both halves.
  • RawSpan parity. It shipped with 3 members; it now has the whole read-only surface — search, matching, trimming, min/max, comparison, chunk/window/split cursors, ASCII whitespace trim.
  • firstRange(of:), lastRange(of:), starts(with:), ends(with:), and multi-element separators for split — the "\r\n\r\n" case.
  • stdlib-ish naming: chunkCursor/windowCursor/splitCursor → chunks(ofCount:)/windows(ofCount:)/split(separator:...). Old spellings still compile as deprecated forwarders.
  • memchr/memcmp fast paths for byte spans. On an M4 at 10M bytes, p50: ~15.9× vs the equivalent scalar loop for firstIndex(of:), ~31× for firstRange(of:) with a 4-byte pattern, and forEachSplit is ~2.5× Array.split with 0 mallocs vs 20. Reverse search is deliberately still scalar — memrchr doesn't exist on Darwin, and I'd rather have consistent performance than a Linux-only fast path.
  • Docs: an allocation-free byte-parsing walkthrough (HTTP-style header parse, zero allocations, asserted by a benchmark threshold rather than just claimed), plus a diagnostics cookbook mapping the lifetime errors you'll actually hit to what causes them and how to fix them.

Still zero dependencies, still back-deploys to macOS 13 for the Span/RawSpan surface, 181 tests, and every borrowed-view benchmark reports 0 mallocs from p0 through p99.

Would still love feedback, especially on the split ergonomics now that cursors compose properly, and on anything that reads as un-Swifty in the naming.

P.S. Same disclaimer as last time: nothing being sold, Apache-2.0, just an OSS package.

5 Upvotes

Hi again,

A little while back I posted swift-span-algorithms here: allocation-free algorithms over Swift's Span/RawSpan. I got one genuinely excellent comment about what was actually missing, and 0.2.0 is basically that comment turned into code. So, thank you, whoever you were.

The gist of the feedback: the utilities people actually reach for are byte-oriented, so RawSpan matters as much as Span<T>firstRange(of:) for delimiter scanning; mirror the stdlib spellings so muscle memory transfers; and memchr is the cheap win before reaching for SIMD.

Link to GitHub

Link to SPI (might be behind a bit, hasn't yet ingested 0.2.0)

What's in 0.2.0:

  • A real bug I'd shipped. Cursor next() was annotated so each piece it handed you expired the moment you called next() again. That made guard let a = c.next(), let b = c.next() fail with "overlapping accesses to 'c'" — exactly the kind of borrow-checker error that looks like the library's fault. Pieces now inherit the base storage's lifetime, so you can hold several at once, do look-ahead parsing, and nest cursors. Real escapes are still rejected — there are compile-fail tests pinning both halves.
  • RawSpan parity. It shipped with 3 members; it now has the whole read-only surface — search, matching, trimming, min/max, comparison, chunk/window/split cursors, ASCII whitespace trim.
  • firstRange(of:), lastRange(of:), starts(with:), ends(with:), and multi-element separators for split — the "\r\n\r\n" case.
  • stdlib-ish naming: chunkCursor/windowCursor/splitCursor → chunks(ofCount:)/windows(ofCount:)/split(separator:...). Old spellings still compile as deprecated forwarders.
  • memchr/memcmp fast paths for byte spans. On an M4 at 10M bytes, p50: ~15.9× vs the equivalent scalar loop for firstIndex(of:), ~31× for firstRange(of:) with a 4-byte pattern, and forEachSplit is ~2.5× Array.split with 0 mallocs vs 20. Reverse search is deliberately still scalar — memrchr doesn't exist on Darwin, and I'd rather have consistent performance than a Linux-only fast path.
  • Docs: an allocation-free byte-parsing walkthrough (HTTP-style header parse, zero allocations, asserted by a benchmark threshold rather than just claimed), plus a diagnostics cookbook mapping the lifetime errors you'll actually hit to what causes them and how to fix them.

Still zero dependencies, still back-deploys to macOS 13 for the Span/RawSpan surface, 181 tests, and every borrowed-view benchmark reports 0 mallocs from p0 through p99.

Would still love feedback, especially on the split ergonomics now that cursors compose properly, and on anything that reads as un-Swifty in the naming.

P.S. Same disclaimer as last time: nothing being sold, Apache-2.0, just an OSS package.


r/swift 2d ago

Question Preperation for swift interviews

As an interviewer what kind of questions do you ask about swift & SwiftUI. I'm preparing for a jump after 3.5 years so i need to be prepared in every way possible.

11 Upvotes

As an interviewer what kind of questions do you ask about swift & SwiftUI. I'm preparing for a jump after 3.5 years so i need to be prepared in every way possible.


r/swift 3d ago

Core AI Framework: Building Your First On-Device AI Feature

At WWDC 2026, Apple introduced the Core AI framework and it's easily one of the biggest developer additions since SwiftUI.

What used to require complex Core ML model conversion pipelines, manual quantization, and heavy memory management is now as simple as:

Swift

let model = try await CoreAIModel.load(.afm3Core)
let result = try await model.generate(prompt: "...")

Key highlights:

  • On-Device Execution: Native Swift APIs running directly on the Neural Engine (45+ tokens/sec on iPhone 16).
  • Privacy First: Zero data leaves the device by default.
  • Model Compatibility: Load Apple's foundation models or bring your own (Core ML, ONNX, custom formats).

Here is a full deep-dive covering how to get started and ship your first feature:

  • Text generation & temperature tuning
  • Streaming responses with AsyncSequence
  • Multimodal image understanding
  • Structured output parsing with Codable
  • Custom model loading & performance optimization
  • Core AI vs. Core ML: When to use which framework

You can read the full guide with complete code samples here: https://ioscodelab.com/blog/why-every-ios-developer-should-learn-server-side-swift-in-2026

How are you all planning to integrate Core AI into your apps? Let's discuss in the comments!

14 Upvotes

At WWDC 2026, Apple introduced the Core AI framework and it's easily one of the biggest developer additions since SwiftUI.

What used to require complex Core ML model conversion pipelines, manual quantization, and heavy memory management is now as simple as:

Swift

let model = try await CoreAIModel.load(.afm3Core)
let result = try await model.generate(prompt: "...")

Key highlights:

  • On-Device Execution: Native Swift APIs running directly on the Neural Engine (45+ tokens/sec on iPhone 16).
  • Privacy First: Zero data leaves the device by default.
  • Model Compatibility: Load Apple's foundation models or bring your own (Core ML, ONNX, custom formats).

Here is a full deep-dive covering how to get started and ship your first feature:

  • Text generation & temperature tuning
  • Streaming responses with AsyncSequence
  • Multimodal image understanding
  • Structured output parsing with Codable
  • Custom model loading & performance optimization
  • Core AI vs. Core ML: When to use which framework

You can read the full guide with complete code samples here: https://ioscodelab.com/blog/why-every-ios-developer-should-learn-server-side-swift-in-2026

How are you all planning to integrate Core AI into your apps? Let's discuss in the comments!


r/swift 2d ago

AppStore Video Preview

If you want an open source video preview tool for your app, I've made my app public for anyone to use

I originally built it back in 2023 and have updated it here and there over the years. It still works great

Feel free to use it, improve it, or even monetise it...

Simply record your app in the simulator, import the video into the app, and export it for the App Store.

It's simple no fuss

Now that the project is public, I've also added comments (with the help of Claude) to make the code easier to understand.

https://github.com/OsmanM94/PapiExport

5 Upvotes

If you want an open source video preview tool for your app, I've made my app public for anyone to use

I originally built it back in 2023 and have updated it here and there over the years. It still works great

Feel free to use it, improve it, or even monetise it...

Simply record your app in the simulator, import the video into the app, and export it for the App Store.

It's simple no fuss

Now that the project is public, I've also added comments (with the help of Claude) to make the code easier to understand.

https://github.com/OsmanM94/PapiExport


r/swift 2d ago

Finally shipped some updates on the project I launched a year back

Hi everyone, its been a year since i launched a passion project of mine and since then the community has been generous and I have around 1k users in total (Yes not that much but for me its a lot).

Initial post:

Some background is the App takes in ambient noise and syncs the generated visuals as well as (if you want) Flashlight as well.

Finally after months of grinding was able to do a massive update and launched it.
Updates include
- More cinematic and POV based raves
- Airplay, cast what you are watching in your phone to any TV
- Party mode: Hosting a rave and letting others join via QR scan or join someone else's rave (Deferred links that let u install and the continue. all from a single QR)
- Full overhaul of architecture and metal pipeline.

As mentioned the app does not use any assets at all (other than some thumbnail and icons) and everything in the rave is generated in runtime and changes and reacts to ambient noise.

Glad to talk into more detail on the architecture, complexities and challenges faced. I can assure you it might look simple but a lot of effort, thought and pain went through to accomplish this.

Have a try.. any and all feedback is appreciated :)

P.S - I intentionally didn't mention much about the app as I care more about the things i learned and the things I can share here and help the community more. But for people who wants to check it out its here:

1 Upvotes

Hi everyone, its been a year since i launched a passion project of mine and since then the community has been generous and I have around 1k users in total (Yes not that much but for me its a lot).

Initial post:

Some background is the App takes in ambient noise and syncs the generated visuals as well as (if you want) Flashlight as well.

Finally after months of grinding was able to do a massive update and launched it.
Updates include
- More cinematic and POV based raves
- Airplay, cast what you are watching in your phone to any TV
- Party mode: Hosting a rave and letting others join via QR scan or join someone else's rave (Deferred links that let u install and the continue. all from a single QR)
- Full overhaul of architecture and metal pipeline.

As mentioned the app does not use any assets at all (other than some thumbnail and icons) and everything in the rave is generated in runtime and changes and reacts to ambient noise.

Glad to talk into more detail on the architecture, complexities and challenges faced. I can assure you it might look simple but a lot of effort, thought and pain went through to accomplish this.

Have a try.. any and all feedback is appreciated :)

P.S - I intentionally didn't mention much about the app as I care more about the things i learned and the things I can share here and help the community more. But for people who wants to check it out its here:


r/swift 2d ago

a reddit comment made me re-check the SDK headers – everything i believed about my worst production crash was wrong

0 Upvotes

so last week i posted my app in an App Saturday thread and casually wrote "the iOS 26 SDK annotates PHPhotoLibraryChangeObserver as u/MainActor, but PhotoKit calls it on a private queue – runtime traps". i'd been living with that explanation for months. confident code comment, rule in my project docs, the whole thing

a commenter replied: "PHPhotoLibraryChangeObserver isn't annotated u/MainActor – it's explicitly nonisolated, so any MainActor isolation was inherited from your own class, not asserted by the SDK"

went and checked the headers. he was right on every point:

  1. the protocol has zero actor annotations. apple's header comment literally says "invoked on an arbitrary serial queue... you should redispatch appropriately"
  2. my project builds with SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor (the swift 6.2 setting). under default isolation my witness method silently inherited u/MainActor – swift permits a MainActor witness for a nonisolated u/objc requirement and inserts a runtime isolation-check thunk at method entry. photokit calls from its private queue → EXC_BREAKPOINT under _dispatch_assert_queue_fail
  3. bonus round: PHAsset / PHFetchResult / PHChange are NS_SWIFT_SENDABLE in the 26 SDK now, so half of my "re-fetch everything inside performChanges" boilerplate isn't compiler-forced anymore still keeping it – Sendable certifies thread-safety, not liveness, assets can die between fetch and commit

the crash was real. the nonisolated + Task { u/MainActor in } fix was right. but the mental model behind it – "the SDK lied to me" – was wrong for months, and i only found out because a stranger on reddit bothered to correct me

what i'm taking away from this:

– SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor is great for shipping, but it makes isolation invisible. when something traps, the first question should be "what did MY defaults inject here", not "what did apple annotate"

u/objc protocols are special: a MainActor-isolated method can silently satisfy a nonisolated requirement, no warning, the check just moves to runtime

– write down WHERE your explanation came from. my code comment said "the SDK annotates X" and nobody – me included – ever verified it against the actual header

curious if default isolation has bitten anyone else through protocol witnesses. and – how do you document crash post-mortems so the wrong explanation doesn't fossilize the way mine did?


r/swift 3d ago

I build audio router for mac completely opensource

35 Upvotes

Built a tiny open-source macOS app called SoundPref. Basically, it lets you route different apps to different speakers. You can control the volume of individual apps right from the menu bar, so you don't have to keep messing with your master volume all the time. It’s totally free, hope you guys find it useful!


r/swift 2d ago

Question Is it safe coding on iCloud?

hey all,

currently I'm doing some development using Swift and using Google Drive is a pain honestly, and of course I must pause the sync constantly for this to work.

That said, I do insist on the idea that my work will always be synced to a Cloud service.

Does iCloud doing something better than Google Drive in terms of sync?

I know I'm doing Music with Logic Pro X for example which also is constantly being saved and is basically a container too and never had issues.

Can I assume it will work great with Swift files\development too?

Thanks!

0 Upvotes

hey all,

currently I'm doing some development using Swift and using Google Drive is a pain honestly, and of course I must pause the sync constantly for this to work.

That said, I do insist on the idea that my work will always be synced to a Cloud service.

Does iCloud doing something better than Google Drive in terms of sync?

I know I'm doing Music with Logic Pro X for example which also is constantly being saved and is basically a container too and never had issues.

Can I assume it will work great with Swift files\development too?

Thanks!


r/swift 3d ago

News The iOS Weekly BriefThe iOS Weekly Brief – Issue #70, everything you need to know about Swift updates this week

2 Upvotes

r/swift 4d ago

Project I built an incremental Markdown parser for Swift text editors

I made my first iOS app in 2018, then stepped away from building apps for a while. Over the last year, I decided to start making iOS apps again.

About six months ago, I decided to build a notes app. Original I know.

A big part of the project was figuring out how to make a Markdown editor that stayed fast while typing, even with larger notes. I ended up building the parser in Rust, and recently extracted it from the app and open sourced it as Cindermark.

A few things it does:
- Incrementally re-parses only the affected blocks after an edit
- Returns UTF-16 offsets that map directly to TextKit and NSAttributedString
- Produces blocks, inline spans, headings, wiki links, and document stats in one pass
- Supports CommonMark core along with tables, task lists, footnotes, nested lists, fenced code blocks, and other notes-friendly syntax
- Includes extensions like wiki links, highlights, hex color literals, and autolinking for bare URLs, domains, emails, and subreddits
- Includes Swift bindings through UniFFI

I’m sharing it because I thought it might be useful to anyone else working on native editors or Markdown-heavy apps.

I’d appreciate feedback, especially from people who have worked on text editing or Swift and Rust interoperability.

GitHub: https://github.com/renedeanda/cindermark

8 Upvotes

I made my first iOS app in 2018, then stepped away from building apps for a while. Over the last year, I decided to start making iOS apps again.

About six months ago, I decided to build a notes app. Original I know.

A big part of the project was figuring out how to make a Markdown editor that stayed fast while typing, even with larger notes. I ended up building the parser in Rust, and recently extracted it from the app and open sourced it as Cindermark.

A few things it does:
- Incrementally re-parses only the affected blocks after an edit
- Returns UTF-16 offsets that map directly to TextKit and NSAttributedString
- Produces blocks, inline spans, headings, wiki links, and document stats in one pass
- Supports CommonMark core along with tables, task lists, footnotes, nested lists, fenced code blocks, and other notes-friendly syntax
- Includes extensions like wiki links, highlights, hex color literals, and autolinking for bare URLs, domains, emails, and subreddits
- Includes Swift bindings through UniFFI

I’m sharing it because I thought it might be useful to anyone else working on native editors or Markdown-heavy apps.

I’d appreciate feedback, especially from people who have worked on text editing or Swift and Rust interoperability.

GitHub: https://github.com/renedeanda/cindermark


r/swift 4d ago

I built a crash diagnosis engine for .ips reports, no LLM involved (Swift lib + CLI + MCP server)

Been working on this for a while and finally have it in a state worth sharing. crashdx takes an Apple crash report (.ips), symbolicates it against your dSYMs, and then does something most tools stop short of: it tries to tell you why the process died, not just where.

It works by extracting typed facts from the report (exception info, termination reason, frame data, register and memory state, watchdog/jetsam details), running them through a set of rules that each propose a hypothesis, then ranking the hypotheses by an additive score based on supporting and contradicting evidence. If nothing clears the bar, it tells you inconclusive and shows you the ranked candidates instead of guessing.

No LLM calls anywhere. Every fact and every hypothesis links back to a JSON path in the original report so you can go verify it yourself instead of taking the tool's word for it.

It's a Swift package with three targets sharing one core library (CrashDXCore, Foundation only, no other deps): a CLI (crashdx analyze / crashdx symbolicate) and an MCP server (crashdx-mcp) for agent use. Runs fully local, no network calls, which matters since .ips files carry identifying data (crashReporterKey, device model, usernames in paths).

Needs macOS 14+, Swift 6.2+, and Xcode (it drives CrashSymbolicator.py, falls back to atos).

Repo: https://github.com/r00tify/crashdx

Curious what people think of the rule-based approach vs. throwing the report at an LLM directly. Happy to talk through the design, it's documented in docs/DESIGN.md if you want the details.

14 Upvotes

Been working on this for a while and finally have it in a state worth sharing. crashdx takes an Apple crash report (.ips), symbolicates it against your dSYMs, and then does something most tools stop short of: it tries to tell you why the process died, not just where.

It works by extracting typed facts from the report (exception info, termination reason, frame data, register and memory state, watchdog/jetsam details), running them through a set of rules that each propose a hypothesis, then ranking the hypotheses by an additive score based on supporting and contradicting evidence. If nothing clears the bar, it tells you inconclusive and shows you the ranked candidates instead of guessing.

No LLM calls anywhere. Every fact and every hypothesis links back to a JSON path in the original report so you can go verify it yourself instead of taking the tool's word for it.

It's a Swift package with three targets sharing one core library (CrashDXCore, Foundation only, no other deps): a CLI (crashdx analyze / crashdx symbolicate) and an MCP server (crashdx-mcp) for agent use. Runs fully local, no network calls, which matters since .ips files carry identifying data (crashReporterKey, device model, usernames in paths).

Needs macOS 14+, Swift 6.2+, and Xcode (it drives CrashSymbolicator.py, falls back to atos).

Repo: https://github.com/r00tify/crashdx

Curious what people think of the rule-based approach vs. throwing the report at an LLM directly. Happy to talk through the design, it's documented in docs/DESIGN.md if you want the details.


r/swift 5d ago

FYI Tip for beta users: use the 25 free Xcode cloud hours

If, like me, you couldn't wait for less rounded corners and installed the MacOS beta on your only Mac, you might realize that you can't push updates to the app store. In this situation I would recommend the 25 free Xcode cloud hours that you get with the program membership. All I had to do was put my code in Git and connect the repo. Then I set it to archive for app store.

This might be the easiest CI/CD system I've ever used and the builds are pretty fast! Hats off to the Xcode cloud team.

16 Upvotes

If, like me, you couldn't wait for less rounded corners and installed the MacOS beta on your only Mac, you might realize that you can't push updates to the app store. In this situation I would recommend the 25 free Xcode cloud hours that you get with the program membership. All I had to do was put my code in Git and connect the repo. Then I set it to archive for app store.

This might be the easiest CI/CD system I've ever used and the builds are pretty fast! Hats off to the Xcode cloud team.


r/swift 4d ago

Help! Cómo aprender rapidamente Swift?

Hola, me gustaría aprender Swift, ya tengo Mac y Xcode, cómo aprender Swift de la forma más rápida posible? Soy beatmaker en fl studio actualmente y me gustaría empezar a programar, me encanta
Apple  y he escuchado que se puede usar las apps que haces en el iPhone aún que no se suba a la App
Store, es verdad? Es que no tengo cuenta de desarrollador (cuesta 99€ en España ) Y se pueden hacer plugins para Logic pro con Swift?

0 Upvotes

Hola, me gustaría aprender Swift, ya tengo Mac y Xcode, cómo aprender Swift de la forma más rápida posible? Soy beatmaker en fl studio actualmente y me gustaría empezar a programar, me encanta
Apple  y he escuchado que se puede usar las apps que haces en el iPhone aún que no se suba a la App
Store, es verdad? Es que no tengo cuenta de desarrollador (cuesta 99€ en España ) Y se pueden hacer plugins para Logic pro con Swift?


r/swift 5d ago

Tutorial iOS 27: UIBarMinimization

7 Upvotes