Skip to content

Instantly share code, notes, and snippets.

@pofat
Last active October 17, 2020 15:09
Show Gist options
  • Save pofat/dd1ec8e5082f4ad698e7b67aaeca4849 to your computer and use it in GitHub Desktop.
Save pofat/dd1ec8e5082f4ad698e7b67aaeca4849 to your computer and use it in GitHub Desktop.
How to write main function in a Swift iOS project
import Foundation
import UIKit
UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, NSStringFromClass(UIApplication.self), NSStringFromClass(AppDelegate.self))
// Remeber to comment or remove `@UIApplicationMain` in your AppDelegate.swift
@li-bei
Copy link

li-bei commented Feb 17, 2020

Why not just pass CommandLine.unsafeArgv to UIApplicationMain's second parameter?

@pofat
Copy link
Author

pofat commented Feb 18, 2020

Why not just pass CommandLine.unsafeArgv to UIApplicationMain's second parameter?

@kylinroc Thanks for the suggestion!!! I just did not notice that property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment