r/swift • • 12h ago

full screen detection breaks on notched macbooks (the window bounds trick doesn't work)

5 Upvotes

ran into this while working on a small mac utility, figured someone else might hit it too

i wanted to know when the user has something full screen (youtube in chrome, a movie, a game etc) so the app gets out of the way. the usual trick is CGWindowListCopyWindowInfo and checking if a window matches the screen frame. works fine on external monitors, but on a notched macbook full screen windows start below the notch and the strip above it is just painted black. so the window is like 32-38pt shorter than the screen, which is pretty much where a normal zoomed window starts too. can't just loosen the check

what ended up working is asking the window server which space each display is on. full screen apps get their own space and its type is 4

```swift

typealias MainConnection = u/convention(c) () -> Int32

typealias CopyDisplaySpaces = u/convention(c) (Int32) -> Unmanaged<CFArray>?

let cg = dlopen("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics", RTLD_NOW)

let mainConnection = unsafeBitCast(dlsym(cg, "CGSMainConnectionID"), to: MainConnection.self)

let copySpaces = unsafeBitCast(dlsym(cg, "CGSCopyManagedDisplaySpaces"), to: CopyDisplaySpaces.self)

func fullScreenDisplays() -> Set<String> {

let displays = copySpaces(mainConnection())?.takeRetainedValue() as? [[String: Any]] ?? []

var result = Set<String>()

for display in displays {

let current = display["Current Space"] as? [String: Any]

if (current?["type"] as? Int) == 4, let id = display["Display Identifier"] as? String {

result.insert(id)

}

}

return result

}

```

the ids are display uuids (or "Main" if you turned off separate spaces per display), you can map them with CGDisplayCreateUUIDFromDisplayID

it's private api so no app store, but it needs zero permissions. AXFullScreen works too but then you need accessibility. i just run it on activeSpaceDidChangeNotification and once more ~0.4s later since the space animates in

anyone know a public way to do this? would rather not rely on CGS stuff


r/swift • • 19h ago

News Fatbobman's Swift Weekly #158

Thumbnail
weekly.fatbobman.com
7 Upvotes

r/swift • • 19h ago

Project I built a calendar where each event has its own tasks

Post image
3 Upvotes

Hi r/swift

Over the past few years, I've been building a productivity app to replace both my calendar and to do apps. It's called Zesfy and you can directly add your daily tasks right inside calendar events instead schedule them one by one. Here's some of the features:

  • It combines your calendar and to-do list into a single view.
  • You can easily schedule multiple tasks together to calendar.
  • Helps you quickly decide what tasks to work on next
  • Organize week tasks with task status
  • Easily keep track of your task progress
  • Works entirely offline

I'd love to hear what you guys think about the app. Let me know if you have any feedbacks.

Download: Zesfy - To Do List & Planner

App subreddit: r/zesfy


r/swift • • 14h ago

Tutorial Maths, Metal, Mandelbrot, and SwiftUI

Thumbnail
blog.jacobstechtavern.com
0 Upvotes

r/swift • • 1d ago

After 6 years, I am moving on from my hobby project.

Post image
19 Upvotes

I started on CoinCurrently with less than 1 year of experience. iOS 14 had just come out, SwiftUI was brand new, and Home Screen widgets were one of the new features.

I figured I’d try to make a couple of widgets and see what happens. I made a few to track cryptocurrencies and posted about it on Reddit. The post got almost 300 upvotes, which I thought was pretty awesome, so I decided to make a whole app, native for both iOS and Android.

Everything I built in the app was for myself — because I wanted to learn and because it was fun to experiment. It seems like people appreciated what I built.

The app peaked at #99 in the Finance category on the App Store and reached 500 daily users. Not too bad for a hobby project!

After 6 years, I’ve achieved more than I could ever have imagined, but my motivation for this project has died down. Because of this, I have open-sourced the two projects so other people can learn from my struggles and take inspiration for their own apps.

The app will continue to be maintained, though there won't be as many new features as before. I have moved on to another project that I am very excited to share in a few weeks.

The app is available on the App Store and Google Play:

iOS: https://apps.apple.com/us/app/coincurrently-private-crypto/id1543974454

Android: https://play.google.com/store/apps/details?id=com.cryptium.coincurrently&hl=en_US

And now it's also on GitHub:

iOS: https://github.com/orre1996/CoinCurrently-iOS

Android: https://github.com/orre1996/CoinCurrently-Android


r/swift • • 1d ago

Open Source Swift UI coder editor

3 Upvotes

I haven't switched to Mac yet because of the crazy exchange rate, and also a lot of my work needs Windows. I really like SwiftUI, but I don't know enough of it to warrant buying a MacBook at this time, since React Native gets the job done - this is how I got the stupid idea of building a lightweight code editor and interpreter for Swift and SwiftUI.

Somewhat AI-assisted, to be honest, I don't have months to invest in this, but it's actually pretty decent, and I was able to build out a pretty complicated UI, all from my browser!

https://github.com/kevincoder-co-za/switaculous

Fully open-sourced and MIT-licensed.


r/swift • • 1d ago

Project NoteKit: an in-place Markdown editor for SwiftUI apps (TextKit 2, zero deps, MIT)

20 Upvotes

NoteKit is a Markdown editor for Mac and iOS built on the system text view (TextKit 2). You see the Markdown source, styled in place as you type. No dependencies, MIT, macOS 14 / iOS 17.

https://github.com/tfcace/notekit

  • Markers like # and ** step aside away from the caret and reappear when it returns.
  • Task boxes, bullets, quote bars and rules are drawn in place of their markers. Tasks tick on click/tap/⌘⏎.
  • Per-line text direction: RTL and LTR lines coexist in one note, task boxes included.
  • Obsidian syntax: wikilinks, callouts, tags, highlights, frontmatter, embeds, Templater. Unknown syntax is shown as written.
  • NSTextView / UITextView underneath, so undo, spell check, dictation and input methods just work.

r/swift • • 2d ago

I built Graffle, an open-source diagramming and vector graphics app for macOS using Swift and AppKit

Post image
73 Upvotes

Graffle, an open-source diagramming and vector graphics app for macOS using Swift and AppKit

Hey everyone!

I've been working on a personal project called Graffle, a native macOS application for creating diagrams and vector graphics.

I built it with Swift and AppKit, and I've decided to make it open source under the MIT License.

Some of the features I've implemented so far include:

  • Shapes, text, and Bézier paths
  • Smart connectors with different routing styles
  • Layers and reusable styles
  • Gradients and shadows
  • SVG import and export
  • PNG and PDF export

My goal was to build a native Mac tool that combines diagramming capabilities with vector editing.

I'm sharing the source code because I'd love to get feedback from other developers and designers, discover what could be improved, and hopefully find people interested in contributing.

I'm still working on the project, so constructive criticism is very welcome!

GitHub repository:
https://github.com/yahirvitelugardo/Graffle

A few things I'd love to hear your thoughts on:

  • What features do you consider essential in a diagramming tool?
  • How would you improve the connector or vector editing experience?
  • Are there any macOS-specific features you'd like to see in an app like this?

Thanks for checking it out!


r/swift • • 2d ago

Free ASO tool for App Store and Google Play: open source, self-hosted, daily rank tracking (AsoBeast)

Post image
7 Upvotes

I'm the developer. It's written in TypeScript, for the part after your Swift app ships.

What frustrated me about ASO tools:

  • They charge per app, per keyword or per seat, which adds up fast for an indie app.
  • I ship on iOS and Android and wanted both stores in one place.
  • I couldn't see how they came up with their popularity and difficulty numbers.
  • My keyword list is my strategy, and it lived on a vendor's server.

So I built my own:

  • Free and open source (AGPL-3.0), self-hosted with Docker Compose.
  • App Store and Google Play, in every storefront: 175 on the App Store (Austria and Switzerland included) and 225 on Google Play.
  • Checks your keyword positions every day down to 200 and keeps the history.
  • One search per keyword and country also records every competitor on that results page, so watching competitors costs nothing extra.
  • Popularity and difficulty come with their inputs, and the docs explain how each one is calculated.
  • If you have an Apple Ads account, you can add your own API credentials and it uses Apple's popularity numbers for the terms Apple publishes. Everything else is an estimate from search results and autocomplete.
  • A keyword field per localization, with a list of tracked keywords your title, subtitle and keyword field don't cover.
  • History of listing and screenshot changes, yours and your competitors', plus review sync.
  • An MCP server, so Claude can answer questions about your rankings.

Setup is four commands from the README, then open localhost:3001. If you don't want to run a server, there's a hosted version for $10 a month with 7 days free and no card. Self-hosting has every feature.

GitHub: https://github.com/AsoBeast/asobeast
Website: https://asobeast.com

Hoping it helps. If you ship on both stores, I'd like to know what you still check by hand.


r/swift • • 1d ago

What do you wish subscription tracker apps did better?

0 Upvotes

Hey everyone!

I've been exploring the idea of building an iOS subscription tracker, but after looking at existing apps, I realized that features like renewal reminders, spending summaries, and subscription calendars are already pretty well covered.

I don't want to build yet another app that does the same things with a slightly different UI. I'd like to understand what people actually struggle with when managing their subscriptions.

For those of you who use subscription trackers, or have tried a few and stopped using them:

  • What's your biggest frustration with the subscription tracker you currently use?
  • Is there a feature you've wanted but haven't found in any existing app?
  • How do you currently track cancellations, price increases, pauses, or subscriptions you've restarted?
  • What would make you switch from your current app to a new one?
  • Would you prefer a one-time purchase, a free app with optional Pro features, or a subscription? Why?

I'm especially interested in the small, frustrating things that existing apps haven't solved well, rather than a long wishlist of features.

Feel free to share the app you currently use and what you like or dislike about it. Honest criticism would be really helpful.

Thanks!


r/swift • • 3d ago

Swift Pro: a Swift plugin I’ve been building for IntelliJ IDEA

Post image
32 Upvotes

I’ve been working on Swift Pro and wanted to share it here. It’s a commercial Swift plugin for IntelliJ IDEA, built around the IDE’s usual editors, toolbars, run configurations and test runner.

It brings together compiler completion and navigation, SwiftPM support, LLDB debugging, XCTest and Swift Testing results, SwiftUI previews and macro expansion.

It uses your installed Swift toolchain; Apple workflows, including previews, require macOS and Xcode.

If you try it, I’d appreciate feedback, especially on setup and everyday usability. I’m happy to answer questions about any of the supported (and unsupported) features.

Swift Pro on JetBrains Marketplace


r/swift • • 2d ago

Project Had a second brain idea while taking a walk and started the build right on my phone ASC approved it in one try

0 Upvotes

While taking a walk early last month I got fed up about how my docs were getting buried in my pile of 100s of notes PRDs and many other docs unstructured in my notes. An agent scaffolded the first iOS, mac app and MCP bridge in a Linux VM box right on that trail while I was walking and it was testing with GitHub actions, I got home and opened the project in Xcode and to my amazement it built on first try and all core functionality worked. Took a month to iterate test and stabilize it.

What it became is Cohestry, a native Swift second brain that automatically connects related notes, resurfaces old ideas when they become relevant again, and gives you a visual map of how your knowledge fits together. The part I care about most though is the MCP bridge, so Claude, Codex, Cursor and other agents can pull in the context you have already built instead of starting from zero every time. My first week using it resurfaced an untitled blueprint to one of my main project that had been lost, cohestry connected it to a doc I was writing for a new feature.

I kept the whole thing native, local-first and fast because I wanted it to feel like an Apple app first, not a web wrapper. It is live now on iPhone and Mac if any Swift folks want to tear it apart or tell me what I should have done differently: https://apps.apple.com/us/app/cohestry-second-brain/id6811573132
Web/demo: https://cohestry.app


r/swift • • 3d ago

Project kinhin: scale your Mac’s CI runners to your queue

Thumbnail
youtube.com
0 Upvotes

kinhin watches your CI queue and, for each queued job, starts a fresh VM or container on your Apple silicon Mac, registers a one-job runner, and deletes it afterwards. Nothing idles and nothing is left over.

It works with GitHub Actions, GitLab CE, Gitea Actions and Forgejo Actions. Buildkite, Azure Pipelines and Bitbucket are planned for a later release.

The limits: Apple allows two macOS VMs at once on a Mac, whatever the hardware. Linux containers are not capped by that.

It’s still a beta. The beta 2 post lists what has been run for real and what hasn’t: https://kinhin.dev/blog/beta-2

Source and releases: https://github.com/RabinApps/kinhin. I’d especially like feedback from anyone running CI on Macs today.


r/swift • • 3d ago

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

Thumbnail
iosweeklybrief.com
1 Upvotes

r/swift • • 3d ago

Tutorial iPhone Duo Group Lab 10/15/26 - Q&A

Thumbnail
antongubarenko.substack.com
1 Upvotes

r/swift • • 3d ago

File converter

1 Upvotes

Hello everyone, I need your help. Do you know some libraries for convert files, for example to convert .pages to .pdf. I build an app, for me, where I can convert many different files into another format. Maybe I need more libraries than 1 or 2. Thank you an advance 🥺


r/swift • • 4d ago

Question Anyone letting agents drive their app in the Simulator? Looking for feedback

23 Upvotes

I’ve been working on Argent, an open-source MCP server that lets your agent (Claude Code, Codex, Cursor, etc.) tap through your app in the iOS Simulator, read the view hierarchy and logs, and profile with Instruments. That way it can check its own changes instead of just saying it’s done

A lot of the feedback so far has come from React Native folks, but it works with plain Swift/SwiftUI/UIKit apps too, and that’s where I’d love more input. If you’re already letting an agent drive your app, what’s working, and where does it fall apart? 😊


r/swift • • 4d ago

I managed to implement SwiftData + CloudKit Sharing in my app

3 Upvotes

Hi everyone! I saw a few discussions about SwiftData that don’t support CloudKit sharing for collaboration yet. I was myself searching for a solution after building my app around SwiftData and when I wanted to add collaboration functionality for my shopping list & grocery management app I discovered that SwiftData don't support sharing like CoreData does, I searched everywhere for a solution and the only solution from people here was to move from SwiftData and switch to core data but I really liked SwiftData and I didn't wanted to change it since it was well implemented with my app written in SwiftUI.

So after a lot of research and tests I managed to make collaboration work as well as syncing the private db perfectly with SwiftData using CKSyncEngine. So if you are also in this place where you have or want to build a SwiftData app and implement collaboration know that you can make it work!

My solution was to use two CKSyncEngine isolated in an Actor, one for the private data and the second for the shared data and a database manager that receives the updates from the engines and writes to the database.

It requires some work to start building it, you'll need to well understand CloudKit and a bit of Swift concurrency but once your first prototype works its pretty straightforward forward from there.

I'd be happy to hear your suggestions or learn how you'd approach it differently and if you have questions i'll be happy to answer them. hop this post can be useful!

Link to my app if you want to try:

Kaeli
https://apps.apple.com/il/app/kaeli/id6756275182


r/swift • • 4d ago

Project Show: a SwiftUI disk cleaner with a getattrlistbulk + FSEvents incremental index

2 Upvotes

I built Ammugghia after finding 100 GB of "System Data" on my MacBook Air: it was mostly iOS Simulator runtimes and Xcode/Gradle caches that Finder doesn't show.

  • Native SwiftUI, signed & notarized, no network, MIT
  • Covers Xcode, simulators, Android, about 30 package-manager caches, Electron app caches, local AI models, leftovers of deleted apps, Docker (volumes are never touched)
  • Every item shows exact paths and what happens after deleting it; Trash by default
  • Disk map, duplicate finder (APFS-clone aware), startup items, history with restore

DMG: https://github.com/Mingo07-dev/Ammugghia/releases/latest Homebrew: brew install --cask mingo07-dev/tap/ammugghia

Feedback welcome, especially cleanup targets I'm missing.


r/swift • • 4d ago

Project What broke (and what didn't) running untrusted Swift in the browser

2 Upvotes

I'm building SwiftQuest, a course where every exercise compiles and runs on a real Swift toolchain. A few things I learned along the way:

One throwaway gVisor container per run. It runs on arm64 Linux, with no network, a read-only system, an unprivileged user, and caps on memory, CPU and processes. A script takes about 1.3 s, a two-file compile about 1.5 s, and the first Swift package build about 20 s.

The compiler's notes vanished. Swift's default diagnostic style prints notes inside an ASCII drawing of your code, and my line-based parser couldn't find them. So add missing case: '.fog' disappeared from every run, in the exact lesson that promised the compiler would name the missing case. Compiling with -diagnostic-style=llvm fixed it. The rule since then: show Swift's own message word for word, and only ever add an explanation underneath. Crashes show Swift's one useful line instead of a full backtrace (SWIFT_BACKTRACE=enable=no).

Lessons tested like code. Early testers found that 18 of about 90 "try changing this" suggestions were wrong: the code didn't do what the text said. Now each one is an edit plus its expected result, and the test suite runs all 289 of them on the pinned toolchain.

The attack suite. Hostile programs try a fork storm, eating memory, filling the disk, endless output, sleeping past the clock, and probing the network. The first run found no hole, but it did find two bugs in the attack programs themselves, including a uname read that crashed under Swift 6.4.

Happy to go deeper on any of this. And if you know someone who's never coded and wants to learn Swift, I'm looking for about 10 beta testers from Oct 26 (free, and Pro for life for finishing): https://swiftquest.dev/beta?ref=beta-reddit-swift


r/swift • • 5d ago

Tutorial iPhone Duo Group Lab 10/13/26 - Q&A

Thumbnail
antongubarenko.substack.com
2 Upvotes

r/swift • • 5d ago

libark: libark is a modern, secure, Swift-native foundational layer over Linux POSIX primitives.

Thumbnail
github.com
11 Upvotes

libark

libark is a modern, secure, Swift-native foundational layer over Linux POSIX primitives.

While originally developed as the core runtime layer for ArkOS, libark is completely decoupled and designed to be used on any Linux distribution. It provides highly secure, object-oriented abstractions over low-level system calls, memory management, and file system interactions, without the burden of manual C interoperability.

Features

  • Object-Oriented POSIX: Wraps file descriptors, paths, and directory operations in safe, RAII-compliant Swift types.
  • Secure Syscall Boundary: Routes kernel interactions through strict, audited Syscall primitives.
  • Terminal Capabilities: Built-in abstractions for TTY detection and window sizing.
  • Advanced Formatting: Standardized formatters for human-readable byte sizes (SI and IEC), ISO 8601 timestamps, permissions, and classifications.
  • Declarative Sorting: Powerful generic SortEngine for metadata sorting across multiple criteria.

r/swift • • 6d ago

Project Harbeth: a texture-first Swift/Metal image and frame engine for Apple platforms

Post image
11 Upvotes

I’m maintaining Harbeth, an open-source Swift/Metal rendering engine for Apple platforms. The part I want to share here is the rendering infrastructure: accepting different source types, composing processing steps, and delivering a result with clear color, alpha, and ownership semantics.

The diagram shows the engine from source to delivery. A photo editor and a camera/video frame pipeline can use the same rendering core while keeping their own application workflows.

There are two integration routes:

  • HarbethIO for direct source + filter processing, with synchronous output() and asynchronous transmitOutput().
  • ImageNode for structured processing: reusable sources, geometry/optics, local effects and masks, transitions, ordered layer composition, and output profiles.

The engine accepts UIImage/NSImage, CGImage, CIImage, MTLTexture, CVPixelBuffer, and CMSampleBuffer. The ImageNode route can deliver a Metal texture or a RenderedFrame carrying output metadata and texture ownership. SwiftUI, UIKit, and AppKit preview hosts can display those results without first turning every frame into a CPU image.

A small frame-processing example:

```swift let node = ImageNode.pixelBuffer(pixelBuffer) .applying(C7Exposure(exposure: 0.25)) .transforming(ImageTransformRecipe(rotationDegrees: 90))

let frame = try await node.makeFrameAsync(profile: .stablePreview) ```

Once the frame is available, a SwiftUI view can display it with:

swift HarbethRenderView(frame: frame, resizingMode: .aspectFit)

Underneath, the runtime handles Metal execution, render-plan/pipeline caching, and texture reuse. Color/alpha, orientation, YUV conversion, HDR/dynamic-range contracts, and readback are explicit parts of the rendering layer; diagnostics and image analysis help inspect the result.

The host app owns capture, playback, recording, file export, persistence, and interaction. Harbeth supplies the image/frame rendering layer. Performance depends on the device, resolution, processing chain, and output path.

If you’ve built a Swift image or frame pipeline, which integration detail caused you the most trouble: buffer conversion, GPU resource lifetime, preview/final consistency, or something else?

Source, examples, and documentation: https://github.com/yangKJ/Harbeth

MIT licensed; targets iOS/iPadOS, macOS, and tvOS.


r/swift • • 6d ago

Tutorial App Size 101: Drop 40% in an afternoon

Thumbnail
blog.jacobstechtavern.com
26 Upvotes

r/swift • • 5d ago

how am i doing?

Post image
0 Upvotes

Just released my app a few days ago, havnt really done any marketing yet. How would yall say im doing so far??