Update the readme to fix code sample

This commit is contained in:
DreamPiggy 2019-12-06 22:51:11 +08:00
parent a3f30bafdc
commit e59739b0e2
1 changed files with 6 additions and 6 deletions

View File

@ -278,7 +278,7 @@ platform :ios, '13.0' # This does not effect your App Target's deployment target
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// ... // ...
if #available(iOS 13, *) { if #available(iOS 13, *) {
window.rootViewController = UIHostingController(rootView: contentView) window.rootViewController = UIHostingController(rootView: ContentView())
} else { } else {
window.rootViewController = ViewController() window.rootViewController = ViewController()
} }
@ -290,11 +290,11 @@ class ViewController: UIViewController {
var label: UILabel = UILabel() var label: UILabel = UILabel()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.view.backgroundColor = .white view.backgroundColor = .white
self.view.addSubview(label) view.addSubview(label)
self.label.text = "Hello World iOS 12!" label.text = "Hello World iOS 12!"
self.label.sizeToFit() label.sizeToFit()
self.label.center = self.view.center label.center = view.center
} }
} }