r/swift • • Jan 19 '21

FYI FAQ and Advice for Beginners - Please read before posting

446 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? (November 2026)

12 Upvotes

What Swift-related projects are you currently working on?


r/swift • • 12h ago

Question Apple Developer Academy Bali – Is it actually worth it?

7 Upvotes

Hey everyone!
I’m considering applying to the Apple Developer Academy in Bali for the next batch, and I’d love to hear some honest opinions from current learners or alumni.
I’m an international applicant and would mostly be financially supporting myself, so I’m trying to figure out whether it’s actually worth spending 10 months there.
I have a few questions:
Is the Academy actually worth it, or is it somewhat overhyped?
How much is the monthly stipend, and is it enough to live comfortably in Bali?
How much do you realistically spend per month on rent, food, transportation, electricity, and other necessities?
How much should I have saved before moving to Bali?
Is it possible to work part-time while attending the Academy, such as freelancing, remote work, or working at a café? Especially as a foreigner on a student visa.
How intense is the daily schedule? Do you have enough free time for personal projects or other commitments?
How good are the mentors and the actual learning experience?
Do you receive any Apple devices to use throughout the program?
Does the Academy actually help with career opportunities, internships, networking, or finding a job after graduation?
How is the experience for international learners? Is the language barrier an issue?
Are there any hidden expenses or things you wish you had known before joining?
Most importantly, if you could go back in time, would you still choose to join the Academy?
I’d really appreciate honest experiences, both positive and negative. I’m not expecting everything to be perfect, but since I’d be moving to another country and supporting myself financially, I want to know what I’m getting into.
Thanks in advance!


r/swift • • 3h ago

I built an open-source GitHub Action that implements issues & opens tested PRs using modern Swift 6 & Xcode 27 rules

1 Upvotes

Hey everyone,

Like many of you, I've tried using AI coding assistants on iOS projects, but was constantly frustrated by:

  1. AI generating outdated iOS 14 / UIKit boilerplate instead of modern Swift 6 / SwiftUI APIs.
  2. Redundant wrapper views (like unnecessary Group { ... } wrappers or .foregroundStyle(.primary)).
  3. AI making an edit, breaking the build, and giving up.

I built PR Forge (pr-forge-ai), an open-source agent that runs in GitHub Actions or your local terminal.

When you comment /forge on an issue: • It detects the project type (SwiftPM or Xcode .xcodeproj). • Applies progressive skills: u/State macro rules, .glassEffect(), WebView/WebPage in SwiftUI, InlineArray, and functional Swift idioms. • Runs swift test or xcodebuild. • Self-audits every checkbox in your issue PRD. • Pushes a commit under PR Forge Bot and opens a PR.

We tested it end-to-end on a live macOS Swift project (Spreading Aroma), where it autonomously built a node statistics counter, code optimizer, and unit test suites that passed CI and merged cleanly.

Repo: https://github.com/shubhransh-gupta/pr-forge

What are the most annoying Swift/Xcode boilerplate patterns you'd want an autonomous agent to automate?


r/swift • • 1d ago

Tutorial Building apps is a system design exercise

Thumbnail
blog.jacobstechtavern.com
17 Upvotes

r/swift • • 23h ago

The iOS Weekly Brief: Issue #88. macOS on iPad, iOS 27.3 beta 2, unknown enum cases, Xcode MCP vs xcodebuild, SwiftUI List internals, container values, drag and drop reordering in SwiftUI, iPhone Duo layouts, and Black Friday deals

Thumbnail
iosweeklybrief.com
3 Upvotes

r/swift • • 1d ago

Question Starting SwiftUi and struggling to find any tutorials that actually explain where the different view elements come from and supported properties. Any books/videos I should watch as an absolute beginner?

14 Upvotes

All the videos I've seen on Youtube involve someone just randomly typing a million properties without any explanation of how they even know that an element supports these properties (e.g., how does Text() have .foregroundStyle and why does this have .white to define colour?)

Option + Click does not reveal this and I'm struggling to find anything that tells me what the properties are.


r/swift • • 2d ago

We rewrote the entire Rust WGPU in Swift, and it looks fantastic. I call it SAGA

Thumbnail
gallery
155 Upvotes

I've been building Ada Engine for the last 4 years, and my main problem has been finding a cross-platform SDK for graphics. I saw that Bevy and other Rust projects use WGPU, and I dreamed of rewriting it in Swift.

With AI, that day has come. In just 3 days, AI agents rewrote the entire Naga compiler and WGPU, which lets us compile WGSL (WebGPU Shading Language) to MSL (Metal Shading Language), GLSL, SPIR-V and HLSL. It all runs on-device, without vendor-specific libraries like SPIRV-Cross.

SAGA, the name of the new graphics SDK, builds and runs on Android, Windows, Web, Linux and Apple platforms. All in Swift! Ada Engine already supports it!

I'm really glad that you can now use a cross-platform graphics API in Swift instead of Vulkan or Dawn.

Check it out: https://github.com/AdaEngine/SAGA


r/swift • • 2d ago

Project I built a Swift package for searching Apple's job listings

11 Upvotes

Hello all,

I recently put out a new package I've been working on to help myself learn about designing libraries. It's called JobsKit. I've been exploring the web service behind jobs.apple.com and decided to turn it into a type-safe Swift API, and figured it'd be nice if other people got a chance to try it out.

The idea behind it was to make it possible to search Apple's job listings using a Swift-based API, instead of manually dealing with the website's requests.

Here's a simple code example so you can see how it works:

import JobsKit

let client = JobsClient()

for try await job in client.allJobs(
    matching: JobQuery(text: "swift")
) {
    print(job.title)
}

You can also filter by teams, products and locations, retrieving detailed job information, and parsing compensation info where available.

It's available for all Apple platforms as well as Linux.

GitHub: https://github.com/mohalibou/JobsKit

This is my first package I've put out there, so if you have any feedback on the implementation, do feel free to let me know about it.


r/swift • • 2d ago

Swift package

1 Upvotes

I decided to build a swift package for using Private cloud compute and Apple's local models, I found it difficult to find the correct places to use them, and there was nothing out there to do it for me automatically, so I built my own!

Its still pretty early, it works on calibration of latency, and adjusts the model used based on request latency, it continuously re-calibrates the more its used based on the users device

Its fully open source, so feel free to check it out!


r/swift • • 3d ago

Project Built a full Google Maps app for Apple Watch with Claude Code: real Google tiles, search, traffic directions, turn-by-turn on the wrist

0 Upvotes

So I've been annoyed for a while that Google Maps on the Apple Watch is basically a remote control for the iPhone app. No map you can actually browse, and you start everything from the phone. On Android watches it's way better. Apple Maps just isn't as good where I live.

So I decided to build my own, and I did pretty much all of it with Claude (Claude Code, in my terminal).

What it does

  • Actual Google map tiles on the watch (standard, satellite, terrain, dark), with traffic/transit/biking layers. Digital Crown zooms, drag to pan, long-press to drop a pin.
  • Google search with autocomplete. Results have ratings, hours, open/closed, reviews, phone numbers.
  • Search results show as a card at the bottom with ◀ ▶ arrows, so you can flip through "coffee near me" one place at a time and the map flies to each one. Way easier than scrolling a list on a tiny screen.
  • Google directions with live-traffic ETAs for driving, walking, cycling and two-wheeler. Transit times come from Apple Maps, because Google won't serve transit routes outside a browser.
  • Turn-by-turn navigation:

    • The turn is a small green chip in the corner ("↱ 40 m") so it doesn't cover the map. Tap it to expand the full card.
    • Turn the Crown for the list of upcoming steps, and again for a page of big buttons (voice, haptics, overview, share ETA, end).
    • Different haptic patterns for left and right turns, so you can tell which way to go without looking. Right is a steady run of taps, left is taps in pairs.
  • One tap to switch voice between on, alerts only and muted. It remembers your choice.
  • If the app gets closed mid-route, reopening it asks "Resume route to X?"
  • Complications, Siri shortcuts ("take me home with Wayfinder"), parking spot saving with a meter timer, trip timeline, compass.

No API key and no iPhone app needed. It talks to Google the same way the Google Maps website does.

Caveats, to be upfront

Unofficial, not affiliated with Google in any way.

  • It uses Google's undocumented web endpoints, so it could break any day if Google changes something, and it's probably against their ToS. Personal/educational use.
  • Not on the App Store. You install it yourself with Xcode; a free Apple ID works. The README walks through it step by step.
  • Needs watchOS 26+. I've tested it on my SE 3 and in the simulator.

Repo with a demo video: https://github.com/GagnDeep/google-maps-for-apple-watch


r/swift • • 3d ago

Distributed actors over HTTP, now playing in a browser near you

Thumbnail
treasure-hunt.examples.elementary.codes
16 Upvotes

Did you know Distributed now works in Embedded Swift (on main)?

I put together a small library, actor-rpc, that turns Swift distributed actors into plain HTTP calls. You write a protocol, the server implements it as a distributed actor, and a client calls it like any other async function. The client can be anything, including an Embedded Wasm app in the browser (like the Treasure Hunt game).

// Shared
@Resolvable
public protocol TreasureHunt: RPCService {
    distributed func newGame(size: Int) async throws -> Game
    distributed func dig(_ cell: Cell, in game: Game) async throws -> DigResult
    distributed func reveal(_ game: Game) async throws -> Cell
}
    
// Browser
let transport = RPCHTTPTransport(executor: FetchExecutor(), options: .init(basePath: "/rpc"))
let hunt = RPCClient(transport: transport).resolve($TreasureHunt.self)

let result = try await hunt.dig(cell, in: game)

A few things I cared about:

  • Boring on the wire. Each call is a JSON POST, so your load balancer, CDN, gateway, observability, etc. don't need to know anything special. The demo runs CloudFront → API Gateway → Lambda.
  • Bring your own server. The server side is one call in your HTTP handler: Vapor, Hummingbird, whatever. The demo uses a bare Lambda handler.
  • KISS. Just a client talking to a server with a Swift protocol as the API. No cluster, no membership, no gossip, no codegen, no YAML.

It's a very early proof of concept (needs a main toolchain and the experimental NewCodable branch), so expect things to move. What do we think?


r/swift • • 3d ago

From UIKit and Storyboards to SwiftUI and Android via Skip

Post image
14 Upvotes

Hey everyone! 👋

Over the past year, I brought my app Budget Flow to Android using Skip while modernizing its existing UIKit- and Storyboard-based interface with SwiftUI.

For those unfamiliar with Skip, it's an open-source framework that enables developers to build native apps for both iOS and Android using Swift and SwiftUI from a shared codebase.

As a solo developer working on the app alongside my full-time job, my goal was to share as much code as possible across platforms without sacrificing the native user experience or existing platform-specific integrations. Since Budget Flow has been in users' hands since 2023, preserving their data and existing features was equally important.

To help other developers considering a similar migration and share some insights from my experience, I've written an article about my journey. It covers why I chose Skip over other cross-platform frameworks, provides an overview of the new architecture, and discusses platform-specific integrations and performance challenges, as well as lessons learned along the way.

You can read the full article here: From UIKit and Storyboards to SwiftUI and Android via Skip

The modernized version has been available on the App Store for about a month, and the Android public beta is now available on Google Play.

I'd love to hear your thoughts and would be happy to answer any questions! 😊


r/swift • • 3d ago

Swift Student Challenge will start soon with events in December

Thumbnail
developer.apple.com
0 Upvotes

All winners will receive one year of membership in the Apple Developer Program and a special gift.


r/swift • • 3d ago

Question Would you be able to tell what my Swift package is for, and whether you'd use it?

0 Upvotes

For anyone who hasn't come across it, I maintain the LocalLM SDK (formerly the LocalLM Lab SDK), for building native Swift Mac apps with AI features. An app can use Apple's on-device model, Private Cloud Compute, open-weight MLX models, or GPT and Claude. Version 3.0 just went GA. I could go on about what's new, but what I'd like to check here is the user journey for a new developer: can someone who hears about the SDK tell quickly what it is and whether it's for them?

I spent some time improving the getting-started experience for 3.0. There's now a landing page, a README on GitHub with a screenshot, a new 50-line quickstart chat written for people new to AI, about twenty examples, and a free Mac app to try things before writing code. Even so, I recently watched an AI agent cold-read (that's apparently a "thing" these days!) the site and come away wrong about which models are supported, which made me wonder whether people do too.

If you have two minutes:

  • Would you end up on the website or GitHub first? And once there, could you tell what this is without scrolling?
  • What would make you actually try it? Or what would make you close the tab?
  • Is a 50-line chat app example using Apple's on-device model a good place to start, or is it jumping into the deep end too quickly?

Site: thisbrain.ai/locallm · GitHub repo at ancientcomputing/locallm


r/swift • • 4d ago

Question tvOS "covr" artwork, can I include more than one aspect?

0 Upvotes

I am developing an app that uses AI to figure out what the media is from the filename along with other "nearby" resources like any text files or the metadata in the file. It then goes to TheTVDB and downloads the artwork.

My question:

The artwork is generally available in three forms, "poster" which is 2 wide by 3 tall, "background" is 16 by 9, and "icon" is 1 by 1.

Does anyone know if it's possible to include more than one image in the covr, and if so, how do I annotate it so the user sees the one they selected?


r/swift • • 4d ago

Help! I have a question about Xcode

0 Upvotes

Unfortunately, i don’t have a MacBook, but I’m learning iOS development (SWIFT) and i need to use Xcode. Are there any way to use all apple features on the windows? I wanted to install macOS on virtual box and use Xcode in this virtual machine, is that even possible? Let me know if there is anything else I can do.


r/swift • • 5d ago

Tutorial iOS 27.1: UIArrangementViewController

Thumbnail
antongubarenko.substack.com
6 Upvotes

r/swift • • 5d ago

News Fatbobman's Swift Weekly #163

Thumbnail
weekly.fatbobman.com
3 Upvotes

r/swift • • 4d ago

A ‘Weak’ Too Far: Debugging a Swift Miscompilation

2 Upvotes

r/swift • • 5d ago

Sysbar: a menu bar system monitor built with SwiftPM only (no .xcodeproj), AppKit + SwiftUI, IOKit/Mach APIs. Open source, plus a few lessons learned

Post image
7 Upvotes

I've been building **Sysbar**, a small macOS menu bar system monitor (CPU with E/P-core split, GPU, memory, disk, network, top processes). It's open source under Apache-2.0, and I thought the implementation might interest people here.

**Repo:** https://github.com/rodrigotrombeta/Sysbar

**Project setup: no Xcode project at all**

- It's a plain SwiftPM `executableTarget` (about 4.3k lines), linking `IOKit` and `ServiceManagement`.

- A ~30-line `build.sh` runs `swift build -c release`, assembles the `.app` bundle by hand (binary, `Info.plist`, icon), ad-hoc signs it with `codesign --sign -` and installs it. You only need the Command Line Tools.

- Release builds are universal: `swift build --arch arm64 --arch x86_64`, then packaged into a DMG.

**Where the data comes from (public APIs only, no sudo, no helper)**

- CPU: `host_processor_info` for per-core ticks, split into E-cores and P-cores on Apple Silicon.

- GPU: `IOServiceMatching("IOAccelerator")`, reading the `PerformanceStatistics` dictionary ("Device Utilization %" and in-use memory).

- Memory: `host_statistics64(HOST_VM_INFO64)`.

- Disk I/O: the `IOBlockStorageDriver` statistics.

- Top processes: `proc_listallpids` + `proc_pid_rusage(RUSAGE_INFO_V4)`.

- Launch at login: `SMAppService.mainApp`.

**UI**

- An `NSStatusItem` with an icon drawn into an `NSImage(size:flipped:drawingHandler:)` on every tick.

- The panels are SwiftUI hosted in an `NSPanel` subclass. A small `NSHostingView` subclass overrides `acceptsFirstMouse` so buttons respond to the first click even when the panel isn't key.

**One lesson that surprised me**

My sparklines started out as SwiftUI `Canvas`. In a panel that stays pinned open and redraws every second, `Canvas` re-rendered through GPU-backed buffers and added **tens of MB** of memory. Switching to plain `Shape` paths (`SparklineShape` filled with a gradient) brought the app back to about **25 MB of RAM**. If you're building something that redraws constantly, measure `Canvas` before committing to it.

**Credits:** the monitoring logic started from the System Stats panel in [oMLX](https://github.com/jundot/omlx), and the menu bar icon is inspired by [Stats](https://github.com/exelban/stats).

I'd appreciate a code review from people who know AppKit better than I do, especially on the `NSPanel`/SwiftUI hosting and hover-tracking parts. Issues and PRs are welcome.


r/swift • • 6d ago

Chord: a free, open-source macOS app for iOS devs working with coding agents

13 Upvotes

When I work on iOS apps with AI agents, I can get a lot done in parallel. The problem was that the agents kept building over each other, and I couldn't run builds or check previews on different branches at the same time.

I also hate having a lot of apps open at once like sourcetree, Xcode, finder, the Simulators and so on. Chord puts all of that in one window. It's now the app I use every day. You can bring your own harness (pi, Claude Code or Codex), run builds and simulators for each branch, and check every SwiftUI preview from a list.

https://github.com/Pistifeju/Chord

It's free and open source, and still in early development.


r/swift • • 6d ago

Project Mference 2.0: Native Swift 6.1 + Metal 3 MoE LLM runtime (18.36 tok/s on Qwen 3.6 35B in 16 GB RAM, zero Python in inference)

Thumbnail
gallery
13 Upvotes

Sharing Mference 2.0 (Apache-2.0 / MIT, forked from NeelM0906/Mference & derived from drumih/turbo-fieldfare) — a native Swift 6.1 + Metal 3 + SwiftUI + SwiftNIO local LLM runtime running Qwen 3.6 35B-A3B (INT4, 256 routed experts) comfortably on a 16 GB Mac.

Swift + Metal Highlights

  1. Custom Metal Kernels + LMHeadChainInt4**:** Batched epilogues (PrefillQKVEpilogue), custom INT4 MoE routers (MoE.encodeRouterGemma4), and exact within-8-row-group top-2 EVICT logit-margin summaries in logit.metal.
  2. MTP Speculative Verify over Gated-DeltaNet + KV: Captures a 4-slot GPU rollback arena (Qwen36MTPSpeculator) and pipelines commitAcceptPass while staying bit-exact with greedy decode (83.1% accept rate, 94.3% AIME, up to 18.36 tok/s).
  3. Bounded Memory + SwiftNIO Server: PreadExpertStreamer with prefill-tail warm start (32 NVMe cache slots), POSIX_MADV_RANDOM slab-only MTP mapping, 2-slot LRU ServerPromptCache, :8080 OpenAI API server, and SwiftUI MferenceMac app.
  4. In-Place BF16 Weight Surgery (MferenceRepack): Scales group-64 affine scale/bias tables (w = s*q + b) atomically in model_weights.bin (0 INT4 nibbles modified), lifting 8-task Pass@1 from 25.0% (2/8) to 100.0% (8/8).

Everything builds via swift build -c release / swift test on macOS 15+!


r/swift • • 7d ago

Anyone using Claude Code with Swift 6.2 lately?

12 Upvotes

Hey folks,

Is anyone here using Claude Code for work? I remember at the start of the year it struggled to understand Swift 6.2's parallelism and concurrency concepts. I was really disappointed and ended up fixing a lot of things manually.

What’s the situation like today?