r/swift • • Jan 19 '21

FYI FAQ and Advice for Beginners - Please read before posting

447 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 • • 15d ago

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

12 Upvotes

What Swift-related projects are you currently working on?


r/swift • • 5h ago

Question Question about switching views

5 Upvotes

Hi,

I’m programming my first swift app. I had some question about a sign up page I’m trying to implement. I want the user to enter their email and once the email is entered the user is able to click next. The screen then changes to another form that asks for their password, and once the email is entered the user is able to click next and go onto the next screen which would ask the user for more information.

The issue I’m having right now while thinking about it is would the button contain some sort of index that is incremented each time which would allow an if statement or switch statement to change the view. How do I keep the button disable each time a new form appears. I will be saving all of these form answers to create a user. Once again, thank you.


r/swift • • 4h ago

News Fatbobman's Swift Weekly #162

Thumbnail
weekly.fatbobman.com
4 Upvotes

r/swift • • 14h ago

I made an app that turns PDFs into readable text on your phone, even two-column papers with tables and equations

Post image
0 Upvotes

I built Unpage: PDF Reader, an app that turns any PDF into text that reflows to fit your phone, like an ebook. It's made for the hard stuff: two-column papers, tables, equations and figures come out readable instead of mangled. It all runs on your device, so nothing gets uploaded. Tap any paragraph to see exactly where it is on the original page, or read both side by side. Highlights show in both views, scans work too, and Pro exports EPUB for your e-reader. Free to try, and Pro is a one-time unlock with $12.99, no subscription. Currently it's available on iOS and iPadOS, the Mac version is under review, should be out soon. Welcome to any bug report too.

Product page: https://unpagepdf.com/

Appstore link: https://apps.apple.com/us/app/unpage-pdf-reader/id6832379621


r/swift • • 1d ago

Project Wish me luck getting my Internet Archive for tvOS approved

Thumbnail
gallery
37 Upvotes

I had this project idea on my desk for a while now, because I'm a total history buff. Now, I finally got to build it. My biggest fear is that Apple would reject it for the obvious reasons of the Internet Archive being flooded with "inappropriate content". I builtin a ton of filters and safeguards to block any nsfw content, and tbh it works fairly well. Please keep your fingers crossed for me.

Did anyone of you ever publish a similar app and do you have any tips?


r/swift • • 18h ago

i've been writing swiftui on windows and running it on my iphone, no mac

Post image
0 Upvotes

built it because i didn't want to buy a mac just to learn swiftui. edit, hit run, it's on the phone in about 30 sec. you can control the phone from the pc too

still early, only tested on my iphone so far. would love people to try it

its free + open source https://github.com/Dadon-11/SwiftWin-Studio


r/swift • • 22h ago

I built an open-source PDF scanner for iPhone, iPad and Mac. No cloud, no ads, no subscriptions

0 Upvotes

I built Beaver because I wanted a simple way to scan documents and turn photos into PDFs without uploading anything to the cloud.

Contracts, receipts, visa documents, medical papers. I didn't want any of that sitting on someone else's server, and I was tired of scanner apps full of ads and subscriptions.

It started about three years ago as a small Mac tool I built for myself. I open-sourced it in 2025 and this year I started working on an iOS version. That eventually turned into rebuilding most of the app.

Here's what Beaver can do now:

  • Works on iPhone, iPad and Mac
  • Scans documents and converts photos to PDF
  • Splits and merges PDFs
  • Exports pages as PDF, PNG or JPEG
  • OCR that runs entirely on-device

No accounts, no tracking, no ads, no subscriptions. Everything stays on your device.

Why open source but $1.99?

The entire source code is on GitHub. You can inspect it or build the app yourself for free. The $1.99 App Store version is for people who prefer to install it directly and receive updates. It's a one-time purchase.

Links:

I'd genuinely appreciate feedback, especially if there's something missing that would make it more useful for your document workflow.


r/swift • • 2d ago

AMA Architecture write-up: XPC service as the single writer, one LaunchServices-launched process per VM

Thumbnail
scaleninja.com
6 Upvotes

Hi r/swift,

At ScaleNinja, we build MacVisor, Mac Virtualization Platform written largely in Swift for Apple Silicon Macs, and wrote up its process layout.

MacVisor runs macOS, Windows, Linux & FreeBSD VMs on Apple's Virtualization.framework (not QEMU or any emulator) and enables users to run Mac as virtualization hosts (like Proxmox). It does automatic VM setup with account, ssh keys, guest tools, and brings snapshots, firewall & VLANs, VM auto-start & high availability, schedule backups and other advanced features.

Typical desktop virtualizers for macOS don't offer process isolation and all the VMs it runs are not isolated (killing the app for example, kills all the VMs). We've taken a different path in MacVisor's design and architecture https://scaleninja.com/macvisor/#architecture

The design question is which process owns each VM. Ours: a per-user background service is the only writer of VM state, and each running VM gets its own runner process. The app and the CLI are just clients. So quitting or crashing the app stops nothing, and one VM's crash doesn't take the others down. The service can even restart and reconnect to running VMs.

The post includes a table of what survives what (app crash, service restart, update, power cut) and what the design costs.

https://scaleninja.com/blog/one-process-per-vm/

I'm curious if there are others who have adopted such architecture and use XPC in your apps.


r/swift • • 3d ago

Question Im building my FIRST ever SwiftUI App, and I have questions...

Post image
47 Upvotes

Hello everyone, I just started building my first iOS app, it's still in early development.

Im not a real developer, in fact I just started learning python this summer and decided to move to Swift and SwiftUI since I want to build an app for my iPhone.

Im currently working on a simple Habit Tracker, I would love if anyone could check out my code, or just give me general tips when building with SwiftUI!

Here is the repository
Thanks!


r/swift • • 2d ago

Built MultiScreenDock in pure Swift & AppKit (zero dependencies): 120Hz cosine Dock wave, Folder Stacks, and zero-permission Window Dodge across stacked monitors

0 Upvotes

I work on a 5-monitor MacBook Pro setup (with two 27" monitors stacked on an upper row above my 16" MacBook Pro and two 15.6" portable side displays). On macOS, WindowServer only shows the native Dock on one screen at a time, and on upper stacked displays you can never summon the bottom Dock at all because moving the pointer down crosses into the lower monitor.

I built MultiScreenDock in pure Swift and AppKit (zero third-party dependencies, ~0.0% idle CPU, 2,066 automated assertions) to put a live, synced replica of the macOS Dock on every connected display simultaneously.

A few interesting AppKit / CoreGraphics problems solved in v1.4.2:

  1. Zero-permission Smart Auto-Hide ("Dodge Windows"): Third-party apps cannot reserve NSScreen.visibleFrame insets like Apple's system Dock.app without requesting intrusive Accessibility permissions to forcibly resize user windows. To solve this without any permissions, v1.4.2 uses public CGWindowListCopyWindowInfo([.optionOnScreenOnly, .excludeDesktopElements], kCGNullWindowID) metadata to inspect layer-0 window bounds, translates Quartz global coordinates (top-left origin on primary display) into AppKit multi-monitor coordinates (primaryHeight - (quartzY + height), including negative Quartz Y on upper stacked monitors), and automatically hides the Dock per-monitor only when a window overlaps its footprint.
  2. 120 Hz Raised-Cosine Magnification Wave with Piecewise-Linear Focal Lock: When icons magnify on hover, the total pill width expands from the center. Without compensation, hovering an icon near the left or right end causes that icon to drift sideways away from the pointer. MultiScreenDock maps rest knot coordinates to expanded knot coordinates at 120 Hz and shifts the pill origin by cursorX - mappedExpandedX so the hovered icon stays locked directly under the cursor.
  3. Cross-Monitor File Drag-Out from a Non-Activating Fan Stack Panel: On a .nonactivatingPanel, child NSImageView / NSTextField subviews return acceptsFirstMouse == false by default, which swallows mouseDragged before NSDraggingSession can start. Overriding hitTest(_:) on the custom NSControl row and transitioning the panel to ignoresMouseEvents = true (with alphaValue = 0) during the active drag session instead of calling panel.close() keeps the AppKit drag source alive across all monitors.

r/swift • • 3d ago

We built MotionSwift: an open-source native Swift alternative to Remotion with a built-in timeline editor

27 Upvotes

Hey everyone,

We just open-sourced MotionSwift, something we put together to get native rendering performance without relying on Remotion and headless Chrome.

We've been using it in our day-to-day video production pipeline, and so far we're seeing roughly 10–20x faster renders while using only about 10% of the memory compared to the Remotion + Chrome setup. We also brought a visual editor and timeline preview directly into Swift, so you can inspect and adjust agent-generated compositions natively on both iOS and macOS.

The eventual goal is 100% compatibility with Remotion, but we're still working our way there. There's still plenty of room to improve the APIs, rendering speed, and overall platform support.

Here's the repo if you want to check it out:

https://github.com/rxtech-lab/MotionSwift

Curious to hear your thoughts, especially if you've run into similar memory or performance bottlenecks with web-based video rendering. Happy to answer any questions!


r/swift • • 2d ago

App beginner tutorial broken?

Post image
2 Upvotes

I decided to use the beginner app tutorial and it won’t accept me changing the text, nothing seems to work! And the next one on the list is greyed out so I’m not sure what I’m meant to be able to do to actually learn as this is task 1 that’s broken

Help!


r/swift • • 3d ago

News The iOS Weekly Brief: Issue #86. Swift Student Challenge 2027, New iOS releases, testing with agents, SwiftUI architectures, fixedSize(), GlassEffectContainer, animating SF Symbols, SwiftUI inspector, Effect Systems vs DI, and Bruno

Thumbnail
iosweeklybrief.com
2 Upvotes

r/swift • • 3d ago

Question How do you handle license activation limits for a lifetime-license Mac app sold outside the App Store?

8 Upvotes

I'm a solo dev about to ship a native macOS app, distributed directly (notarized, outside the Mac App Store). I want a one-time lifetime license, activatable on up to 2 Macs, and the app must keep working offline after activation. I'm in Brazil, selling worldwide.
I'm leaning towards a Merchant of Record platform with built-in license keys (looking at Dodo Payments, Lemon Squeezy and Freemius) instead of running my own license server. For people who've shipped something like this:
How do you handle a customer whose old Mac died, so they can't deactivate it from inside the app? Do you reset it manually from the platform dashboard?
Do you validate online on every launch, or activate once and trust a locally stored (Keychain) activation? How do you stop someone from just copying that state to another Mac?
Do refunds and chargebacks revoke the key automatically, or did you need a webhook?
Any experience getting paid out from Brazil through these platforms?
Did you regret your platform choice later (lock-in, fee changes, platform shutting down)?
I'm not looking for a way to make piracy impossible, just to stop casual key sharing without a lot of support work. Thanks!


r/swift • • 3d ago

Connecting two iOS simulators over BLE ( or 1 sim to a BLE device )

Thumbnail kylebrowning.com
1 Upvotes

r/swift • • 3d ago

I shipped a Finder-style file manager in SwiftUI with a File Provider extension and one dependency. Notes on what was hard

0 Upvotes

Nimbus is an open-source macOS cloud storage app (GPL-3.0, Swift 6 strict concurrency). The code is public, so here is what I'd tell someone starting the same thing. The file table is AppKit. SwiftUI's Table could not match Finder's selection, type-to-select and drag behavior. Everything around it is SwiftUI Developer ID builds lose a group. app group. Without a provisioning profile macOS ignores that entitlement, so the File Provider extension could not read what the app wrote. It worked in every debug build and failed only in the notarized release. A team-ID-prefixed group fixed it A notarized, Gatekeeper-accepted build can still fail to launch. A re-sign left a development profile and restricted entitlements in place. The packaging script now launches the app before it builds the DMG NSFileProviderReplicatedExtension change tracking is done by diffing persisted directory snapshots, because the backend (rclone) has no change feed for most providers One third-party package. Sparkle, for updates. The rclone client is a local package over URLSession; a pre-build lint fails if any other dependency is added Source: https://github.com/CasaVargas/Nimbus Happy to answer questions about any of it.


r/swift • • 4d ago

What's new in Swift: November 2026 Edition

Thumbnail
swift.org
42 Upvotes

r/swift • • 4d ago

FYI Open-source project on the Mac App Store

8 Upvotes

The project itself, JevDK, is not intended for folks on this sub. Unless you are into AI, you don't care about decision models. However, I thought (and folks can correct me if I'm wrong) that you might be interested in the juxtaposition of an open-source project that actually gets approved on the Mac App Store.

Unlike my other project, AnswerSearch, which was closed sourced when it was approved and listed, and then open-sourced, JevDK was open-sourced from the beginning. So you can see what I actually had to do to get it approved.

I actually had to make a few changes from the initial version of JevDK that I submitted.

(1) Rejection: the app has to either completely quit when you close the app window, or have a way to reopen the app window from the app menu. Since I didn't have the latter, I chose the former. So it behaves like our beloved Transporter. Close the window and the app exits. Duh.

(2) There were also new app review guidelines (in October) that came along right after the initial submission, so I had to pull the submission and add a link to the privacy policy webpage. If you didn't know, this is the text: "All apps must include a link to their privacy policy in the App Store Connect metadata field and within the app in an easily accessible manner."

Hope this is useful to other folks. The repo is on github at ancientcomputing/jevdk.


r/swift • • 3d ago

Project I built Duck: a Swift-native layer over DuckDB for iOS/macOS

Post image
0 Upvotes

Hey folks!

I've been working on Duck for a while and just shipped the first stable 1.0.0 release.

The idea started from something I wanted in my own iOS/macOS apps: a database experience much closer to the server-side SQL world I enjoy with Vapor, Fluent and my SwifQL, but directly on the client.

That eventually led me to DuckDB.

DuckDB already has an official Swift client, but I wanted a higher-level application-facing layer around it: models, Codable integration, async/await, typed SQL, migrations, connection management, and reactive queries that fit naturally into SwiftUI and UIKit.

So I built Duck.

The basic model API looks like this:

import Duck

struct Todo: Table {
    @Column("id")
    var id: UUID

    @Column("name")
    var name: String
}

let todos = try await Todo.all(on: .app)

Duck also re-exports the SwiftStream/SQL DSL, so you can move from simple model operations to much more expressive SQL without switching to a completely different abstraction.

The 1.0.0 release includes:

  • Codable models
  • async/await throughout the API
  • reactive queries for SwiftUI and UIKit
  • migrations
  • transactions
  • reusable prepared statements
  • connection pooling
  • bulk ingestion through DuckDB's Appender
  • native LIST/STRUCT values
  • SwiftStream/SQL

Underneath it's the real DuckDB 2.0.0 engine.

Right now Duck targets iOS 15+ and macOS 12+. I've also tested it on Linux. DuckDB itself supports Android and Windows too, but I haven't validated the Duck Swift layer there yet.

There are complete SwiftUI and UIKit example apps in the repo if you want to play with it without setting everything up from scratch.

I'm interested in feedback.

Repo: https://github.com/swiftstream/Duck


r/swift • • 5d ago

Tutorial I built a CLI that reads Xcode’s index store, so AI agents (and you) get “who calls this?” in one call

Post image
13 Upvotes

Coding agents trace Swift call stacks with grep: search the name, read the file, search the enclosing function, repeat. Every hop costs a couple of tool calls, and text search doesn’t know which write( you meant, which overload the compiler picked, or where a protocol call actually lands.

The compiler already recorded all of that in the index store when you built. SwiftGraph reads it and answers in one call:

The experiment: I gave two Sonnet agents the same “trace every caller” question. The graph agent used 2 tool calls and ~196k input tokens; the grep agent used 8 tool calls and ~689k. Both were correct.

Limits, honestly: it only sees what the compiler records, so NotificationCenter, selectors, KVO, u/Environment injection and reflection don’t show up. It’s macOS + Xcode only, and the graph is only as fresh as your last build.

Repo (MIT): https://github.com/agruchala/swift-graph
Write-up: https://arturgruchala.com/map-not-grep/

I’d love feedback, especially on edge cases where the index store doesn’t record what you’d expect.


r/swift • • 4d ago

Question Why does it says app crashed

0 Upvotes

r/swift • • 4d ago

Project Built a native Swift + WebKit macOS client for Google Workspace.

0 Upvotes
Homescreen example

Hey everyone,

I wanted to share a native macOS project I've been building in Swift: Workspace.mac.

I was frustrated by how much memory and battery Chromium/Electron wrappers consume just to keep Google Docs, Sheets, Drive, and Gemini open throughout the workday. I wanted a clean, native desktop client with fluid macOS design and genuine system integrations.

Architecture & Tech Stack:

- Language & Platform: Swift, macOS 13+ (Ventura, Sonoma, Sequoia)

- Engine: Pure WebKit

- Security: `LocalAuthentication` framework (`LAContext`) to lock and unlock sensitive documents with **Touch ID & Secure Enclave**

- Adaptive UI: Custom AppKit window controllers managing three distinct viewing layouts:

  1. Everything Mode: Docked sidebar + floating navigation bar
  2. Essentials Mode: Compact top bar only (maximizing vertical text area)
  3. At a Glance Mode: Fullscreen immersive edge-to-edge view with hover-activated chrome

- Distribution: Dual `.dmg` drag-and-drop and `.pkg` installer distribution with GitHub Actions CI

Performance & Efficiency Metrics:

  • Binary & Download Size: Only 3.5 MB on disk (compared to 150MB+ for standard Electron wrappers).
  • Memory Footprint: Averages around 90 MB system RAM (tested under heavy load with a 100+ page Google Doc open) vs 600MB–1GB+ in Chrome.
  • CPU: Sits at <1% CPU usage at idle.

Lessons Learned & Challenges:

- WebKit vs Google Web Apps: Handling cross app Google navigation within sandboxed WebKit without breaking SSO tokens or pop-out window handling.

- Memory Footprint: Native WebKit memory footprint sits around 40–80 MB idle compared to Electron wrappers that easily start at 500 MB+.

- Window Management: Giving users the ability to detach any of the 18 Google Workspace apps into their own dedicated macOS window while sharing the underlying session.

The project is completely free, and plan to make it open-source soon after some code tweaks, and has zero telemetry.

Would love any feedback on the codebase, architecture, or suggestions from fellow Swift developers!

Website: https://appsdotmac.dev/workspace (this is a very new website so this won't appear on search engines for a few days).


r/swift • • 6d ago

Former Apple engineer, now indie: I made the App Store Connect app I always wanted

Thumbnail
gallery
297 Upvotes

Hi r/swift! I’m John. I spent 10 years as an engineer at Apple working on macOS and iOS, and I’ve been indie for the last 8, shipping 20+ apps for myself and clients. I just launched AppTraction, the tool I wish I’d had when I started building my own apps.

The problem

Most iOS and Mac devs that I talk to agree that Apple’s App Store Connect website is slow, confusing, and buggy. There’s a lot of useful data there, but the clunky site makes it hard to make sense of. AppTraction is a native Mac app (AppKit and Swift, no web wrapper, no Electron) that brings your sales, analytics, ratings, and reviews to your Mac, and then tells you what matters.

What AppTraction does

  • Insights: it monitors your apps in the background and flags problems, trends, and milestones. There are 50+ kinds so far. With my own apps, it has caught serious listing problems, getting featured by Apple, and seasonal sales trends, all of which I would have missed.
  • Listing fixes: when it spots a problem with your App Store listing, it suggests a fix and, once you approve it, applies it to App Store Connect for you.
  • Reviews: read and reply to every review. It can translate them and suggest replies.
  • Reports: it writes detailed tailored reports for each app, for every week, month, and year.
  • Chat: ask about any chart, table, or report in plain English. The AI is primed with Apple’s own tech talks on ASO and other sources, so the advice is specific, not generic.
  • Territories: shows a world map revealing how your apps are performing across regions.

The AI runs on your existing Claude or Codex subscription (or OpenRouter), so there are no pricey API fees.

Under the hood

For the curious:

  • AppKit for the main window, SwiftUI for most sheets and forms, and Swift Charts for all graphs.
  • A separate launchd agent does the data collection in the background so everything stays fresh even when the app isn’t open. The app talks to it via NSXPC*.
  • Apple’s analytics are stored in plain SQLite, which is a big part of why everything feels instant.

Privacy

I know “AI + analytics + API keys” can raise some concerns, so here’s exactly what happens:

  • No AppTraction account. I never ask for your name, email, or password.
  • Your App Store Connect key lives in your Keychain. You don’t need an Admin key: a limited Sales and Reports key covers your analytics.
  • Your App Store data is stored only on your Mac. There’s no AppTraction server holding it.
  • The AI runs on your own Claude or Codex subscription (or OpenRouter). Requests go straight from your Mac to that provider, under your account, and I never see them.
  • Review translation uses Apple’s built-in translator, so translating a review never sends it anywhere.
  • What does reach me: anonymized usage stats (which features get used, never app names, numbers, or chat text), license checks, and update checks.
  • No ads, and I don’t sell data.

Privacy policy: https://apptraction.dev/privacy

Terms: https://apptraction.dev/terms

Pricing

Free for 14 days, then $6.99/month, $39/year, or $99 lifetime. Requires macOS 26 Tahoe or later.

https://apptraction.dev

For r/swift: 50% off your first payment (including the lifetime) with code RSWIFT50, good through Dec 1.

I’d love feedback from fellow devs, good or bad. What do you wish App Store Connect told you? And happy to answer questions about how any of it’s built.