NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

App Groups vs Keychain Access Groups

Forums > macOS

Here's a scenario I'm thinking about. Let's say there's a system that's generating log events; not a bajillion of them, let's say it's on the order of a dozen per hour. So we don't want some kind of enterprise cloud scale log processing system.

I want one process to be run via launchd that will go fetch log events that are new since some marker, and a separate application that will display the log events to the human user. In order to fetch the log events, the log system wants the requester to be authorized. So there's an OAUTH path that happens in the second application (the one that does the display to a human) and that path results in an access token from the server. Both of these applications are going to want to have that access token, so it should sit in a shared location.

So far, this seems like it's probably a Keychain item, although it could be a String that's stored in a UserDefaults instance for an App Group -- since either way, it's only accessible to the user who did the authenticating and to the applications that are using it.

Next, though, there's the question of the log events that have been pulled down from the remote system and saved locally so that the GUI app can display them without generating additional load on the remote system. Where should those get written? Let's say they're Codable JSON and each one is pretty small, so conceivably they could fit in a MySQL table. MySQL seems like it's probably overkill, though; probably some kind of file based storage. Should it be in ~/Library/Application Support/niftyLogParser or should it be somewhere else?

Thoughts, anyone?


Hacking with Swift is sponsored by MadMachine

SPONSORED Want to try Swift on microcontrollers? MadMachine provides ways to interact with the physical world in a Swift way. Join us and have fun!

Get it now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.