Files
helloworld-ios-ota/Sources/App.swift
T

32 lines
1.1 KiB
Swift

import UIKit
@main
final class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
let label = UILabel()
label.text = "Hello, world!"
label.font = .systemFont(ofSize: 32, weight: .bold)
label.textAlignment = .center
let viewController = UIViewController()
viewController.view.backgroundColor = .systemBackground
viewController.view.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
label.centerXAnchor.constraint(equalTo: viewController.view.centerXAnchor),
label.centerYAnchor.constraint(equalTo: viewController.view.centerYAnchor),
])
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = viewController
window.makeKeyAndVisible()
self.window = window
return true
}
}