Home > Mobile >  Mac Catalyst: Determine App's Command Line Arguments
Mac Catalyst: Determine App's Command Line Arguments

Time:06-19

Is there a way within a Mac Catalyst app to access the arguments passed along to an application launched through the command line?

Thinking it would be passed through to func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { however, it doest not appear there.

CodePudding user response:

According to Apple’s documentation ProcessInfo is available on Catalyst 13, so this should give you what you need:

import Foundation

let args = ProcessInfo.processInfo.arguments

The type of args is [String].

  • Related