Skip to content

Instantly share code, notes, and snippets.

@tib
Forked from pofat/main.swift
Created February 17, 2020 08:32
Show Gist options
  • Save tib/3541bc9e2c643f6578b4d884e32fcd85 to your computer and use it in GitHub Desktop.
Save tib/3541bc9e2c643f6578b4d884e32fcd85 to your computer and use it in GitHub Desktop.
How to write main function in a Swift iOS project
import Foundation
import UIKit
private let pointer = UnsafeMutableRawPointer(CommandLine.unsafeArgv).bindMemory(to: UnsafeMutablePointer<Int8>.self, capacity: Int(CommandLine.argc))
UIApplicationMain(CommandLine.argc, pointer, NSStringFromClass(UIApplication.self), NSStringFromClass(AppDelegate.self))
// Remeber to comment or remove `@UIApplicationMain` in your AppDelegate.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment