r/iOSProgramming • • 2d ago

Discussion iOS dev (Swift/SwiftUI) moving to macOS: what are your do's and don'ts?

Hey all,

I've shipped a few iOS apps with Swift and SwiftUI, and I'm now planning my first Mac app: a small, lightweight menu bar utility.

I know the basics carry over, but I suspect macOS has its own traps that iOS devs don't see coming. For those of you who've made the jump:
What do you wish you'd known before your first Mac app?

What are the common mistakes iOS devs make on macOS (windowing, menu bar behavior, sandboxing, permissions)?

Any SwiftUI vs AppKit advice for menu bar apps? Is MenuBarExtra solid enough now, or do you still drop to NSPanel/NSStatusItem?

Distribution: App Store vs direct download? How painful is signing and notarization?
Pricing: do one-time purchases still work best for Mac utilities?

I'm aiming for a small, focused MVP rather than a feature-heavy app, so any "don't overbuild" lessons are welcome too.
Thanks!

8 Upvotes

19 comments sorted by

2

u/onefish857 2d ago

MenuBarExtra is fine for a tiny popover, but if you want a window that stays open or normal click-outside dismiss, you'll end up wrapping an NSStatusItem anyway. start there if the utility is more than a couple of toggles.

turn on accessory (no dock icon) early, and if you're distributing outside the app store, run a developer id notarization in week one even if you're not shipping yet. mac app store signing is closer to what you already do for ios, but the sandbox is pickier. only add entitlements you actually hit; file access and launch at login are usually the first surprises.

for a menu bar tool i'd just do a one-time purchase. don't build a settings window before it does one job well.

1

u/cristi_baluta 2d ago

Be sure to have the sandbox enabled when starting to develop for mac, and not find later when uploading to appstore its constraints. I’d still do it even if not intended for appstore.

1

u/dahiya_xa 2d ago

sandboxing is the big one. if youre going app store, check early which apis you need, a lot of menu bar utility stuff (accessibility api, controlling other apps) just doesnt work sandboxed. if you need that go direct with developer id, notarization is pretty painless once notarytool is in a build script. for selling outside the store paddle or lemon squeezy handle licenses and tax. one time pricing is way more normal on mac than ios so i wouldnt overthink it. and keep it small, menu bar apps mostly live or die on opening fast

1

u/ThanhDongNguyen 2d ago

MenuBarExtra is fine if your UI is a simple menu or a small fixed popover. Once you need to control when it closes, resize it, open it from a global shortcut, or have a text field that takes focus properly, you end up on NSStatusItem + NSPanel. I'd start with MenuBarExtra(.window) and drop down only when you hit the wall, your SwiftUI view can stay the same.

Biggest iOS habit to unlearn: a menu bar app can stay running for weeks without relaunch. Set LSUIElement so there is no Dock icon, and watch memory and timers.

Settings window: use the Settings scene, but in a menu bar app call NSApp.activate before opening it, otherwise it often shows up behind other windows.

Permissions: if you need Accessibility or screen recording, that rules out the App Store sandbox for a lot of utilities. Decide this first because it decides your distribution.

Direct download: Developer ID + notarytool is not that painful once it's scripted. The annoying part is updates, so add Sparkle from day one.

Pricing, I think one-time still works for small Mac utilities. Keep the MVP to one thing done really well, menu bar users don't like apps that try to do everything.

1

u/Which_Concern2553 SwiftUI 2d ago

I do multiplatform apps and sandboxing permissions is a big one. Some things work on iOS and don’t on macOS as it’s tighter. Good luck πŸ’•πŸ’•πŸ’•

1

u/Iamvishal16 2d ago

Nobody's really touched pricing yet so: one-time still seems like what people expect for a small Mac utility. Subscriptions for something that lives in the menu bar get a lot of pushback in reviews and on here. I went with a single lifetime unlock on mine for that reason.

A few Mac things worth knowing early. Settings is its own scene and people will hit Cmd+comma expecting it to open, even in a menu bar app with no dock icon, and getting that window in front when you're an accessory app is fiddly (you usually end up calling NSApp.activate yourself). For launch at login just use SMAppService, the old helper app approach isn't worth it anymore. Also test with a second display and with the menu bar set to auto hide, popover positioning gets weird.

On not overbuilding, I'd skip a big preferences window at first. Two or three toggles is plenty for v1.

1

u/New_Barber8073 2d ago

One small detail that is easy to miss is the menu bar icon. Use a template image so macOS tints it correctly for light mode, dark mode and tinted wallpapers, otherwise it can look off or vanish on some setups. Adding basic keyboard support early also helps, since Mac users tend to expect it.

1

u/dawedev 2d ago

Decide early if it's an agent app (LSUIElement, no Dock icon), and if so put Settings and Quit in the menu itself, because there's no app menu to fall back on. MenuBarExtra is fine for a simple menu, but the window style gets awkward once you need text field focus or custom sizing, and a lot of people end up with NSStatusItem plus NSPopover. For launch at login use SMAppService and test it from a signed, notarized build, not only from Xcode. If you plan the Mac App Store, turn on the sandbox from day one so you find the blocked APIs early.

1

u/FirstAbbreviations75 1d ago

biggest one for menu bar apps: decide early if you want app store distribution, because the sandbox limits a lot of what utilities usually want to do (accessibility apis, other apps' windows, etc). if you need any of that, notarized direct download is way less painful than finding out at review time

1

u/Difficult_Duty2198 1d ago

one thing that caught me out was launch at login. test it early with SMAppService from an installed copy in /Applications, it behaves differently than running from xcode.

1

u/[deleted] 1d ago

[removed] β€” view removed comment

1

u/AutoModerator 1d ago

Hey /u/huckingfooligan12345, your content has been removed because Reddit has marked your account as having a low Contributor Quality Score. This may result from, but is not limited to, activities such as spamming the same links across multiple subreddits, submitting posts or comments that receive a high number of downvotes, a lack of recent account activity, or having an unverified account.

Please be assured that this action is not a reflection of your participation in our subreddit. This is simply an automated filter in place to reduce spam.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

0

u/[deleted] 1d ago

[removed] β€” view removed comment

1

u/AutoModerator 1d ago

Hey /u/ArteSoftOfficial, your content has been removed because Reddit has marked your account as having a low Contributor Quality Score. This may result from, but is not limited to, activities such as spamming the same links across multiple subreddits, submitting posts or comments that receive a high number of downvotes, a lack of recent account activity, or having an unverified account.

Please be assured that this action is not a reflection of your participation in our subreddit. This is simply an automated filter in place to reduce spam.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.