SwiftUI App 适配 iPad All In One
作者:互联网
SwiftUI App 适配 iPad All In One
.navigationViewStyle(StackNavigationViewStyle())
bug ❌
//
// TodoListApp.swift
// TodoList
//
// Created by xgqfrms on 2022/5/20.
//
import SwiftUI
@main
struct TodoListApp: App {
// 实例化 ViewModel
@StateObject var listViewModel: ListViewModel = ListViewModel();
var body: some Scene {
WindowGroup {
CustomEditView()
.environmentObject(listViewModel)
// 国际化
// .environment(\.locale, .init(identifier: "en"));
// .environment(\.locale, .init(identifier: "en-US"));
// .environment(\.locale, .init(identifier: "zh-Hans"));
}
}
}
solution ✅
//
// TodoListApp.swift
// TodoList
//
// Created by xgqfrms on 2022/5/20.
//
import SwiftUI
@main
struct TodoListApp: App {
// 实例化 ViewModel
@StateObject var listViewModel: ListViewModel = ListViewModel();
var body: some Scene {
WindowGroup {
CustomEditView()
// 适配 iPad 宽屏幕 ✅
.navigationViewStyle(StackNavigationViewStyle())
.environmentObject(listViewModel)
// 国际化
// .environment(\.locale, .init(identifier: "en"));
// .environment(\.locale, .init(identifier: "en-US"));
// .environment(\.locale, .init(identifier: "zh-Hans"));
}
}
}
refs
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载
标签:iPad,en,locale,适配,App,environment,init,xgqfrms,identifier 来源: https://www.cnblogs.com/xgqfrms/p/16303861.html