Skip to content

Commit

Permalink
调整下结构
Browse files Browse the repository at this point in the history
  • Loading branch information
ming1016 committed May 9, 2024
1 parent cc3a209 commit 58f6470
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 39 deletions.
79 changes: 41 additions & 38 deletions SwiftPamphletApp/Guide/GuideListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,33 +201,6 @@ final class GuideListModel {
]),
L(t: "SwiftUI数据流")
]),
L(t: "Combine",sub: [
L(t: "介绍",sub: [
L(t: "Combine是什么"),
L(t: "Combine的资料")
]),
L(t: "使用说明",sub: [
L(t: "publisher"),
L(t: "Just"),
L(t: "PassthroughSubject"),
L(t: "Empty"),
L(t: "CurrentValueSubject"),
L(t: "removeDuplicates"),
L(t: "flatMap"),
L(t: "append"),
L(t: "prepend"),
L(t: "merge"),
L(t: "zip"),
L(t: "combineLatest"),
L(t: "Scheduler")
]),
L(t: "使用场景",sub: [
L(t: "Combine网络请求"),
L(t: "Combine KVO"),
L(t: "Combine通知"),
L(t: "Combine Timer")
])
]),
L(t: "SwiftData",sub: [
L(t: "创建@Model模型"),
L(t: "SwiftData-模型关系"),
Expand All @@ -240,24 +213,54 @@ final class GuideListModel {
L(t: "SwiftData-调试"),
L(t: "SwiftData-资料")
]),
L(t: "Widget 小部件")
L(t: "系统能力",sub: [
L(t: "Swift-DocC")
]),
L(t: "工程模式", sub: [
L(t: "单例"),
L(t: "程序入口点")
]),
L(t: "Swift Concurrency",sub: [
L(t: "Swift Concurrency是什么"),
L(t: "async await"),
L(t: "Async Sequences"),
L(t: "结构化并发"),
L(t: "Actors"),
L(t: "Distributed Actors"),
L(t: "Swift Concurrency相关提案"),
L(t: "Swift Concurrency学习路径"),
L(t: "Swift Concurrency和Combine"),
L(t: "Concurrency技术演进")
L(t: "多线程", sub: [
L(t: "Swift Concurrency",sub: [
L(t: "Swift Concurrency是什么"),
L(t: "async await"),
L(t: "Async Sequences"),
L(t: "结构化并发"),
L(t: "Actors"),
L(t: "Distributed Actors"),
L(t: "Swift Concurrency相关提案"),
L(t: "Swift Concurrency学习路径"),
L(t: "Swift Concurrency和Combine"),
L(t: "Concurrency技术演进")
]),
L(t: "Combine",sub: [
L(t: "介绍",sub: [
L(t: "Combine是什么"),
L(t: "Combine的资料")
]),
L(t: "使用说明",sub: [
L(t: "publisher"),
L(t: "Just"),
L(t: "PassthroughSubject"),
L(t: "Empty"),
L(t: "CurrentValueSubject"),
L(t: "removeDuplicates"),
L(t: "flatMap"),
L(t: "append"),
L(t: "prepend"),
L(t: "merge"),
L(t: "zip"),
L(t: "combineLatest"),
L(t: "Scheduler")
]),
L(t: "使用场景",sub: [
L(t: "Combine网络请求"),
L(t: "Combine KVO"),
L(t: "Combine通知"),
L(t: "Combine Timer")
])
]),
]),
L(t: "动画", sub: [
L(t: "布局动画")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ do {
}
```

其中 batchSize 参数是调整批量处理的数量,也就是一次加载多少对象。因此可以通过这个值来权衡内存和IO数量。
其中 batchSize 参数是调整批量处理的数量,也就是一次加载多少对象。因此可以通过这个值来权衡内存和IO数量。这个值默认是 5000。
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ struct SomeView: View {
}
```

## context

View 之外的地方,可以通过 ModelContainer 的 context 属性来获取 modelContext。

```swift
let context = container.mainContext
let context = ModelContext(container)
```

## 预先导入数据

方法如下:
Expand Down

0 comments on commit 58f6470

Please sign in to comment.