LiTranslate-iOS/LiTranslate/Presentation/BookmarksView.swift
Viktor 5ac00486dc
release v1.1 (#1)
Now speech synthesizer works in silent mode.
Fixing iOS 16 compatibility:
- Speech syntesizer
- Colors
2022-10-24 20:52:38 +03:00

55 lines
1.8 KiB
Swift

//
// BookmarksView.swift
// LiTranslate
//
// Created by Viktor Kalyniuk on 18.08.2022.
//
import SwiftUI
struct BookmarksView: View {
@EnvironmentObject private var bookmarksData: BookmarksData
@Binding var tabSelection: Int
var body: some View {
List {
Color(uiColor: Colors.UIColors.Background.main)
.frame(height: 1)
.frame(maxWidth: .infinity)
.listRowInsets(EdgeInsets())
.listRowSeparatorTint(.clear)
.listRowSeparator(.hidden)
.listRowBackground(Colors.Background.mainView)
ForEach(bookmarksData.array, id: \.self) { bookmark in
let bookmarkModel = BookmarkModel(
inputLanguage: bookmark.inputLanguage,
outputLanguage: bookmark.outputLanguage,
inputText: bookmark.inputText,
outputText: bookmark.outputText)
BookmarkView(tabSelection: $tabSelection,
bookmarkModel: bookmarkModel)
.listRowBackground(Color.clear)
.buttonStyle(.plain)
.background(Colors.Background.primaryView)
.cornerRadius(CGFloat(Numbers.twentyFive))
.listRowSeparator(.hidden)
}
.onDelete { IndexSet in
bookmarksData.array.remove(atOffsets: IndexSet)
}
}
.environment(\.defaultMinListRowHeight, 1)
.modifier(ScrollContentBackgroundModifier())
.background(Color(uiColor: .systemGray5))
.listStyle(.sidebar)
}
}
struct BookmarksView_Previews: PreviewProvider {
static var previews: some View {
BookmarksView(tabSelection: .constant(2))
.environmentObject(BookmarksData())
}
}