在project.pbxproj中,我将developmentRegion更改为ar,以在整个应用程序中强制使用阿拉伯语言和RTL布局,除了本例中的菜单视图内容外,一切看起来都很好:
\nimport SwiftUI\n\nstruct ContentView: View {\n \n @State private var selectedTime: Int = 0\n \n var body: some View {\n Form {\n Picker("", selection: $selectedTime) {\n Text("\xd8\xb5\xd8\xa8\xd8\xa7\xd8\xad\xd8\xa7\xd9\x8b").tag(0)\n Text("\xd9\x85\xd8\xb3\xd8\xa7\xd8\xa1\xd9\x8b").tag(1)\n }\n .labelsHidden()\n .pickerStyle(SegmentedPickerStyle())\n Menu {\n Button("\xd8\xa7\xd9\x84\xd8\xb3\xd8\xa8\xd8\xaa", action: {})\n Button("\xd8\xa7\xd9\x84\xd8\xa3\xd8\xad\xd8\xaf", action: {})\n Button("\xd8\xa7\xd9\x84\xd8\xa7\xd8\xab\xd9\x86\xd9\x8a\xd9\x86", action: {})\n Button("\xd8\xa7\xd9\x84\xd8\xab\xd9\x84\xd8\xa7\xd8\xab\xd8\xa7\xd8\xa1", action: {})\n Button("\xd8\xa7\xd9\x84\xd8\xa7\xd8\xb1\xd8\xa8\xd8\xb9\xd8\xa7\xd8\xa1", action: {})\n Button("\xd8\xa7\xd9\x84\xd8\xae\xd9\x85\xd9\x8a\xd8\xb3", action: {})\n Button("\xd8\xa7\xd9\x84\xd8\xac\xd9\x85\xd8\xb9\xd8\xa9", action: {})\n } label: {\n Label("\xd8\xa7\xd9\x84\xd9\x8a\xd9\x88\xd9\x85", systemImage: "calendar")\n }\n }\n }\n}\n\nstruct ContentView_Previews: PreviewProvider {\n static var previews: some View {\n ContentView()\n .preferredColorScheme(.dark)\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n菜单内的按钮标签被翻转
\n\n …import SwiftUI
struct ContentView: View {
@State private var items: [ItemModel] = Array(0...100).map { ItemModel(id: $0, title: "item \($0)", age: $0) }
@State private var selection = Set<ItemModel.ID>()
@State private var sorting = [KeyPathComparator(\ItemModel.age)]
var body: some View {
Table(items, selection: $selection, sortOrder: $sorting) {
TableColumn("id", value: \.id) { Text("\($0.id)") }
TableColumn("title", value: \.title)
TableColumn("age", value: \.age) { Text("\($0.age)") }
}
.onChange(of: sorting) {
items.sort(using: $0)
}
.font(.caption)
.frame(width: 960, height: 540)
}
}
struct ItemModel: Identifiable {
var id: …Run Code Online (Sandbox Code Playgroud) // swift-tools-version:5.5
import PackageDescription
let package = Package(
name: "PKG",
platforms: [.iOS(.v15)],
products: [
.library(name: "Lib1", targets: ["Lib1"]),
.library(name: "Lib2", targets: ["Lib2"]),
.library(name: "Lib3", targets: ["Lib3"]),
],
dependencies: [
],
targets: [
.target(name: "Lib1", dependencies: []),
.target(name: "Lib2", dependencies: []),
.target(name: "Lib3", dependencies: []),
]
)
Run Code Online (Sandbox Code Playgroud)
我正在创建一个包含多个产品的包,我将其上传到github以在我的项目中的SPM中使用它,
它让我选择要添加到我的项目中的库,这就是我想要的,但无论我选择什么,它都会将所有库及其文件带到我的项目中,这是它的工作原理吗?或者我可以让它只下载选定的库及其依赖项吗?
谢谢
struct ContentView: View {
var body: some View {
NavigationView {
List {
Text("Hi")
}
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .principal) {
Text("Title")
.font(.headline)
}
ToolbarItem(placement: .navigationBarLeading) {
Button(action: {}) {
Image(systemName: "person.circle")
.font(.largeTitle)
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
在.font(.largeTitle)上Image有没有影响,只有当我使用一个按钮里面。
这是一个错误还是我做错了什么?