r/swift • • Jan 19 '21

FYI FAQ and Advice for Beginners - Please read before posting

444 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 • • 2d ago

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

8 Upvotes

What Swift-related projects are you currently working on?


r/swift • • 13h ago

The future of Swift outside of Apple

45 Upvotes

A few years ago, much activity surrounded Swift and its potential for backend work. That excitement appears to have faded, leaving Swift as the Apple programming language. What is occurring now? Does Swift have a future beyond Apple? Who is using it and for what?

And is Swift used outside of Apple?


r/swift • • 9h ago

Help! Just finished my first Swift/Swift UI course. Now what?!

10 Upvotes

Hi everyone!

I just finished the 100 days of SwiftUI course by Paul Hudson and it was great. I completely fell in love with the language and with developing in swift. So much so... that I don't know where to go now. Originally my plan was to learn SwiftUI so I could focus on UI and design systems. But now that I have seen different applications, I want to learn advanced swift, advanced SwiftUI, backend programming, server side code, etc. I know that if I go wide, I won't go very deep... so I'm coming to you, redditors, to ask: what would you recommend I focus on next?
- Vapor and server side for backend?
- Stick to my OG plan and continue with SwiftUI and design systems?
- Look into multi-platform coding and working in more than just Swift?
- Go deep into advanced swift?
- Despair.

Would love any advice!

Thanks!!

.p.s. if it helps, i have some background in engineering (industrial) but not super deep in software, and I've mainly worked as a UX designer, so some concepts are not totally foreign to me... but it also doesn't help because it makes me interested in everything. 🙃


r/swift • • 8h ago

Question Notification routing gets weird with multiple accounts

5 Upvotes

I have gotten in to a weird iOS issue and idk what the clean way to handle this is

i’ve got multiple accounts, notifications can open a post, reply, quote, or repost, and each notification belongs to a specific account. so the user might be on account A when they tap a notification for account B.

something like:

struct NotificationDestination {
    let accountID: Account.ID
    let postID: Post.ID
    let kind: DestinationKind
}

enum DestinationKind {
    case post
    case reply
    case quote
    case repost
}

The issue is:

account A is active
notification comes in for B
user taps it while the app is waking up
account switching starts
timeline restoration starts
post resolution starts
then another notification comes in for A lol

so i have stuff like:

await accountManager.restore()
await timelineStore.hydrate()
await postResolver.resolve(postID)
await navigationCoordinator.navigate(...)

But obviously these things are all racing each other. i was thinking of putting the notification intents behind an actor:

actor NavigationIntentQueue {
    private var pending: [NavigationIntent] = []

    func enqueue(_ intent: NavigationIntent) {
        pending.append(intent)
    }
}

But idk, this feels like a lot of machinery just to open a notification

Then you get into cases where the post is deleted while you’re restoring, but the quote is still there, the reply is still there, etc. Is this just an annoying app lifecycle issue?


r/swift • • 10h ago

Question Deciding if I should code with Swift

0 Upvotes

I’m really interested in coding apps but I barely know any coding (I only know block coding like Scratch) is it really easy to learn?

Edit: forgot to clarify that I mainly want to code games


r/swift • • 2d ago

News Google Cloud: Introducing the Server Side Cloud Swift SDK

Thumbnail
cloud.google.com
154 Upvotes

Google: “[Swift] has matured into a viable systems and cloud language, pairing Rust-like data-race safety with predictable, reference-counted performance.”


r/swift • • 2d ago

Project GPU Accelerated Linear Algebra Library for Apple Silicon using MLX and Metal kernels with Swift Support

Thumbnail
github.com
38 Upvotes

About 6 months ago, I wrote a custom metal kernel that leverages the GPU to compute the QR decomposition (see my earlier post about it here). The project has now expanded into a general linear algebra library, with expanded support for the symmetrical eigendecomposition as well as SVD. It is now available for use with installation instructions on the attached github repo's README.md file.

Context of the project:
I'm currently in a research group working on a thesis in numerical analysis where we need to compute millions on matrices with a specific constraint (to be precise, the matrices need to have orthonormal columns). Most of us use Apple computers, so we ended up using MLX for the entire project.

Contributors with different Apple Chips would be very much appreciated!
The project has currently been tested and optimised for the M1 and M5 Pro. The issue is that the library uses different kernels depending on the batch size and matrix dimensions. Deciding which of these kernels to use is machine dependent. Therefore, other Apple chips will need to run a measurement script in order to derive the correct optimisation heuristic.

For that reason, I would ask as many people as possible to run a measurement script and to submit the results to my repo. It is fairly easy and requires only few steps. See here how you can contribute here. Once you submit the results via a pull request and I approve it, your optimisation heuristic will automatically be augmented into the library. Don't hesitate to contribute an optimisation heuristic even if someone already submitted one for your own machine. The more data we can gather, the better!

Project Future
Expanded support will be added for other linear algebra operations (cholesky decomposition for example). If you have any other specific linear algebra operations you wish to use already, feel free to message me.

In addition to that, I will add torch support too (my greatest priority).


r/swift • • 3d ago

a swift bird has been nesting outside my house what should i feed it?

51 Upvotes

r/swift • • 2d ago

News The iOS Weekly Brief: Issue #80. Everything you need to know about Swift updates this week

Thumbnail
iosweeklybrief.com
3 Upvotes

r/swift • • 2d ago

Calling macOS's private Unified Asset Framework service from a Swift CLI

2 Upvotes

I wanted to delete Apple Intelligence's models on macOS 27 without turning SIP off. pared (github.com/4evy/pared) had already worked out how. The asset service takes a ResetAssetSets operation over XPC on com.apple.siri.uaf.subscription.service, and the interface comes from UAFXPCProxyServiceInterface. I dlopen UnifiedAssetFramework in an Objective-C target and call it from Swift.

You have to be careful with the AssetSets list. An empty list means every set, so the bridge refuses to send one. Everything else in the tool is a configuration profile and some CFPreferences calls.

Source is MIT: https://github.com/omlahore/RemoveMacAI


r/swift • • 2d ago

Senior iOS dev (7 YOE) in Brazil: is $35-40/h realistic for remote work with US/EU companies?

0 Upvotes

Hi all! I'm a senior iOS developer based in Brazil with 7 years of experience (Swift, UIKit, SwiftUI). I'm looking at remote contract roles with foreign companies, and my research suggests a range of $35-40/h. Most listings I see are lower (around $4k/month), which are probably staffing agencies taking a cut.

For those of you working remotely for US/EU companies:

  • What rate or salary are you getting, and at what seniority?
  • Did you find the roles through direct hiring, platforms like Toptal, or agencies?
  • Is $35-40/h realistic, or is that too optimistic?

Thanks!


r/swift • • 3d ago

I made a CLI tool for remote compilation caching in Xcode

6 Upvotes

https://github.com/Ryu0118/x8

There are already great compilation caching tools like Tuist that can significantly speed up Xcode builds. However, adopting them may require substantial changes to your project structure.

I wanted to keep my existing Xcode project structure and build using only the toolchain provided by Apple. So I built X8, a CLI tool for remote compilation caching.

Starting with Xcode 26, Apple provides built-in support for remote compilation caching. X8 acts as a lightweight proxy between Xcode’s built-in remote cache mechanism and any S3-compatible storage.

Using X8 is simple. First, configure your S3-compatible storage in .x8.yml. Then, you can either build your project through X8:

x8 xcodebuild ...

or start the cache proxy directly:

x8 serve

and add the generated build settings to your .xcconfig.

That’s it. With just an .x8.yml configuration, you can use remote compilation caching without significantly changing your existing project structure or moving away from Apple’s native Xcode toolchain.

For my app, a clean build used to take around 400 seconds, but with X8, it now takes about 263 seconds.

It’s still relatively slow, but I think that’s expected since Xcode still needs to perform steps such as module planning, build description generation, and linking.


r/swift • • 3d ago

Tutorial Iterative data loading in Swift

Thumbnail
swiftwithmajid.com
4 Upvotes

r/swift • • 3d ago

Editorial Swift vs Flutter? When to Choose Which

Thumbnail
youtu.be
0 Upvotes

r/swift • • 5d ago

Write Web Components in Swift

Post image
62 Upvotes

ElementaryUI can now make Web Components!

Define a custom element in Swift, then use it directly from HTML — which also makes it easy to mix Swift components into existing apps using other web frameworks.

30s video demo on Bluesky

Release Notes 0.8

Web Components on elementary.codes


r/swift • • 4d ago

Tutorial iPhone Duo UIKit Q&A - Forums

Thumbnail
antongubarenko.substack.com
1 Upvotes

r/swift • • 5d ago

Follow-up on StateUI: every platform now has its own native host written in Swift (macOS, iOS, Android, Windows and Linux)

40 Upvotes

A while ago I posted StateUI here as an experiment: Swift for the UI, with .NET MAUI underneath providing the controls on each platform. It worked, but every change had to cross into C# as a binary patch, and an app's own native views had to go through another runtime. So I dropped MAUI to get better performance and simpler interop, and every platform now has its own native host written in Swift. The host reads typed patches directly, in the same process, and an app's own native views - an MTKView, a GtkGLArea, a Direct3D SwapChainPanel - plug in straight from Swift.

You write an app's interface once in Swift, and each platform draws it with its own controls: AppKit on the Mac, UIKit on iPhone and iPad, Android Views, WinUI 3 on Windows and GTK 4 with libadwaita on Linux.

That's the same Gallery app, one Swift module, on four of them. There's no custom renderer and no web view. A button is an NSButton, a UIButton, an Android Button, a WinUI Button or a GtkButton.

How it works: Swift owns the UI tree, the state, the diffing and the animation. Each platform has a thin host, also written in Swift and running in the app's own process, that applies sparse patches to the native controls. On Android the host reaches Java through JNI, and on Windows it reaches WinUI through a small C++/WinRT layer, but the logic stays in Swift.

struct CounterPage: View {
    @State private var count = 0

    var content: some View {
        VStack {
            Label("Tapped \(count) times")
            Button("Tap me").onClicked { count += 1 }
        }
    }
}

Reading a state rebuilds only the body that read it. Handing a binding to a control lets the host update that control without rebuilding anything. In the video, the cube is an MTKView the app registers with the host. Its size, colour and spin come from Swift state, and the edge reaches the view as a binding, so dragging the slider rebuilds nothing: the counter in the corner counts the rebuilds, and the slider adds none.

The same sample uses each platform's own graphics API: Metal on macOS and iOS, Direct3D 11 on Windows, OpenGL on Linux and OpenGL ES on Android.

Every host runs the same conformance suite, and the platform matrix in the repo is generated from those test runs. So it shows what actually works on each platform, not what I hope works. Not everything is covered everywhere yet, and the matrix says exactly where.

It's pre-1.0, and the API still changes when a platform shows me a better model. It needs Swift 6.4. Apache 2.0.

https://github.com/idexus/StateUI

I'd love to hear what you think, especially from anyone who's tried shipping Swift outside Apple platforms.


r/swift • • 5d ago

Question Contributing to Open Source

5 Upvotes

How do I go about contributing to open source projects in swift? For context, I have made some self-projects. I am new to open-source. Should I just pick any project from GitHub and work on their beginner-friendly issues?


r/swift • • 6d ago

Question Firebase Analytics suddenly causing production iOS crashes with no app release, anyone else have this?

30 Upvotes

Anyone else seeing this?

Our production app suddenly started crashing around 00:41 UTC today, across multiple already-released versions, with no new app release.

The crash is:

Fatal Exception: NSInvalidArgumentException

-[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil

The stack points to Firebase Analytics experiment handling, immediately after a successful sdk-exp response.

We're using Firebase iOS SDK 12.14.0.

Relevant issue: https://github.com/firebase/firebase-ios-sdk/issues/16728

I'm wondering if anyone else is seeing the same spike or has found a workaround.


r/swift • • 5d ago

What I learned switching from backend development to native iO

Thumbnail
shiftmag.dev
3 Upvotes

r/swift • • 5d ago

Question Looking for an expert review/audit for "vibe-coded" iOS apps before App Store submission?

0 Upvotes

Hi everyone,

I’ve recently "vibe-coded" (built entirely using AI/prompting) a few iPhone and iPad apps. The feedback from my close circle has been incredibly positive, and the apps are running smoothly.
Now, I’m looking to take the next step and release them on the App Store. Since Apple’s app review process is notoriously strict—and AI-generated code can sometimes have hidden architectural flaws, edge-case crashes, or insecure API integrations—I really want to get a professional to audit them before I submit.

My questions for the community:

  1. Are there specific platforms or communities where I can hire/pay experienced Senior iOS developers for a professional code and App Store guideline review?

  2. Has anyone here done an "App Store Readiness Audit" for an AI-built app? If so, would you recommend platforms like Upwork, Fiverr, or specific boutique tech agencies?

  3. What are the biggest technical gotchas I should look out for in vibe-coded apps regarding the official Apple Developer Guidelines?

Would love to hear your advice and experiences. Thanks in advance!


r/swift • • 6d ago

Tutorial iPhone Duo SwiftUI Q&A - Forums

Thumbnail
antongubarenko.substack.com
3 Upvotes

r/swift • • 6d ago

Help! How to bundle and consume a Metal library in the same Swift package?

2 Upvotes

I'm trying to include a Metal library in a Swift package which I am then adding as a dependency to an Xcode project. The idea is to develop as much as possible in reusable Swift packages and write a thin wrapper UI in the Xcode project itself, but for some reason, the data types declared in the header file that is supposed to serve as the single source of truth between Swift and Metal, aren't visible to the Swift code in the same package.

The following is my Package.swift:

// swift-tools-version: 6.4
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "ProcCity",
    platforms: [.macOS(.v27), .iOS(.v27)],
    products: [
        // Products define the executables and libraries a package produces, making them visible to other packages.
        .library(
            name: "ProcCity",
            targets: ["ProcCity"]
        ),
    ],
    targets: [
        // Targets are the basic building blocks of a package, defining a module or a test suite.
        // Targets can depend on other targets in this package and products from dependencies.
        .target(
            name: "ProcCity",
            resources: [
                .process("library.metal"),
            ],
        ),
    ]
)

The shader library is compiling just fine and is being made available as the default library through a special extension automatically added to the Bundle type by the package manager, but if I try to use any of the types declared in the Metal / C header, Swift complains about their non-existence.

Is there a way to fix this problem? I thought about moving the header to a module of its own while leaving the shaders in the same module as the Swift code, but that's so ugly, and if I move the shaders along with the header I lose the automated extension to the Bundle type.

Alternatively, is there a clean way to replicate the module property that is added as an extension to the Bundle type to refer to a different module? This way I could move both the shaders and their header to a different module without losing the ability to still load them in the ProcCity Swift module.


r/swift • • 5d ago

Everything I learned making my app not look like a default Mac app with SwiftUI

Post image
0 Upvotes

When I first started app development, I made a skeuomorphic stopwatch app that had titlebars and commenters said I should get rid of them. I spent time experimenting and learning how to remove them, and learned a few other things along the way.

Here is everything I learned about macOS title bars using Swift, SwiftUI, and NSView.

https://www.youtube.com/watch?v=nEQZhpJAj2g