Skip to content

Commit

Permalink
Bookmarks view #59: Set columns of bookmarks view to 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
filimo committed Dec 6, 2019
1 parent 992c8f6 commit 1f5e3e7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ struct BookmarksView: View {
@State var filter = ""

private let bookmarkWidth: CGFloat = 100
private let columnts = 2

var body: some View {
VStack {
TextField("", text: $filter).frame(width: bookmarkWidth * 3)
BookmarksView_List(width: bookmarkWidth, filter: $filter, selectedWord: $selectedWord)
TextField("", text: $filter).frame(width: bookmarkWidth * CGFloat(columnts))
BookmarksView_List(columnts: 2, width: bookmarkWidth, filter: $filter, selectedWord: $selectedWord)
BookmarksView_Controls()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import SwiftUI
struct BookmarksView_List: View {
@ObservedObject var store = Store.shared

var columnts: Int
var width: CGFloat
@Binding var filter: String
@Binding var selectedWord: String
Expand All @@ -30,7 +31,7 @@ struct BookmarksView_List: View {
bookmarks = bookmarks.filter { $0.text.contains(filter) }
}

return bookmarks.sorted.chunked(into: 3)
return bookmarks.sorted.chunked(into: columnts)
}

var body: some View {
Expand Down Expand Up @@ -66,6 +67,6 @@ struct BookmarksView_List: View {

struct BookmarksView_List_Previews: PreviewProvider {
static var previews: some View {
BookmarksView_List(width: 100, filter: .constant(""), selectedWord: .constant(""))
BookmarksView_List(columnts: 2, width: 100, filter: .constant(""), selectedWord: .constant(""))
}
}
2 changes: 1 addition & 1 deletion ReaderTranslatorMac/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>462</string>
<string>463</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.education</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion ReaderTranslatorSafari/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>719</string>
<string>723</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSAppleEventsUsageDescription</key>
Expand Down

0 comments on commit 1f5e3e7

Please sign in to comment.