Skip to content

Commit

Permalink
修补
Browse files Browse the repository at this point in the history
  • Loading branch information
ming1016 committed Mar 13, 2024
1 parent 2bfd014 commit 20eba9c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions SwiftPamphletApp/InfoOrganizer/Info/InfoListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ struct InfoListView: View {
Menu("Sort", systemImage: "tag") {

Picker("分类", selection: $filterCate) {
Text("全部")
.tag("")

ForEach(cates) { cate in
Text(cate.name)
.tag(cate.name)
Expand Down Expand Up @@ -71,6 +74,8 @@ struct InfoListView: View {
ToolbarItem(placement: .navigation) {
Menu("Sort", systemImage: "tag") {
Picker("分类", selection: $filterCate) {
Text("全部")
.tag("")
ForEach(cates) { cate in
Text(cate.name)
.tag(cate.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct InfosFilterWithCateView: View {
info.category?.name == filterCateName
}
}, sortBy: sortOrder)
fd.fetchLimit = 1000
fd.fetchLimit = 10000
_infos = Query(fd)

self._selectInfo = selectInfo
Expand Down
2 changes: 1 addition & 1 deletion SwiftPamphletApp/InfoOrganizer/Info/InfosView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct InfosView: View {
|| info.des.localizedStandardContains(searchString)
}
}, sortBy: sortOrder)
fd.fetchLimit = 1000
fd.fetchLimit = 10000
_infos = Query(fd)

self._selectInfo = selectInfo
Expand Down
6 changes: 3 additions & 3 deletions SwiftPamphletApp/InfoOrganizer/Model/InfoDataModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class IOInfo {
var name: String = ""
var url: String = ""
var des: String = ""
var category: IOCategory?
var category: IOCategory? = nil// 关系字段,链接 IOCategory

var createDate: Date = Date.now
var updateDate: Date = Date.now
Expand Down Expand Up @@ -43,7 +43,7 @@ final class IOInfo {
@Model
class IOCategory {
var name: String = ""
var infos: [IOInfo]? = [IOInfo]()
var infos: [IOInfo]? = [IOInfo]() // 关系字段,链接 IOInfo

var createDate: Date = Date.now
var updateDate: Date = Date.now
Expand All @@ -58,7 +58,7 @@ class IOCategory {
}

static var all: FetchDescriptor<IOCategory> {
var fd = FetchDescriptor(sortBy: [SortDescriptor(\IOCategory.updateDate, order: .reverse)])
let fd = FetchDescriptor(sortBy: [SortDescriptor(\IOCategory.updateDate, order: .reverse)])
return fd
}

Expand Down

0 comments on commit 20eba9c

Please sign in to comment.