-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bookmarks for mobile version #66: Speak Longman sentences
- Loading branch information
Showing
5 changed files
with
118 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
ReaderTranslatorPlayer/Views/ViewModes/BookmarksView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// bookmarksView.swift | ||
// ReaderTranslatorPlayer | ||
// | ||
// Created by Viktor Kushnerov on 14/12/19. | ||
// Copyright © 2019 Viktor Kushnerov. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct BookmarksView: View { | ||
@ObservedObject var store = Store.shared | ||
|
||
var body: some View { | ||
VStack { | ||
ScrollView { | ||
VStack(spacing: 0) { | ||
ForEach(store.bookmarks, id: \.self) { bookmark in | ||
HStack { | ||
NavigationLink( | ||
destination: LongmanView(), | ||
label: { Text(bookmark.text).font(.largeTitle) } | ||
) | ||
NavigationLink( | ||
destination: SentencesView(bookmark: bookmark.text), | ||
label: { self.bookmarksIco } | ||
) | ||
Spacer() | ||
self.counterImageIco(counter: bookmark.counter) | ||
.onTapGesture { self.store.bookmarks.increase(bookmark: bookmark) } | ||
} | ||
} | ||
} | ||
} | ||
}.padding() | ||
} | ||
|
||
private var bookmarksIco: some View { | ||
Image(systemName: "book.circle") | ||
.resizable() | ||
.aspectRatio(contentMode: .fit) | ||
.frame(height: 25) | ||
.padding(.trailing, 10) | ||
} | ||
|
||
private func counterImageIco(counter: Int) -> some View { | ||
let name = counter == 0 ? "0.circle" : "\(counter).circle.fill" | ||
return Image(systemName: name) | ||
.resizable() | ||
.aspectRatio(contentMode: .fit) | ||
.frame(height: 25) | ||
.padding(.trailing, 5) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// LongmanView.swift | ||
// ReaderTranslatorPlayer | ||
// | ||
// Created by Viktor Kushnerov on 15/12/19. | ||
// Copyright © 2019 Viktor Kushnerov. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct LongmanView: View { | ||
@ObservedObject var store = Store.shared | ||
|
||
var body: some View { | ||
LongmanRepresenter() | ||
.onAppear { | ||
self.store.hideNavBar = false | ||
} | ||
} | ||
} | ||
|
||
struct LongmanView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
LongmanView() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters