Select Git revision
ReadMainView.swift
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
ReadMainView.swift 2.66 KiB
//
// ReadMainView.swift
// enzevalos_iphone
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import SwiftUI
struct ReadMainView <M: DisplayMail>: View {
public var mail: M
var body: some View {
TabView{
ForEach(Tabs, id: \.id ){ tab in
tab.content
.tabItem {
tab.image
Text(tab.description)
}
}
}
}
//TODO: not use AnyView-workaround
var Tabs:[Tab] {
get {
return [
Tab(
image: Image(systemName: "shield"),
description: "security",
content:AnyView(SecurityBriefingView(mail: mail))
),
Tab(
image: Image(systemName: "person.fill"),
description: "sender",
content: AnyView(SenderViewMain<M>(mail: mail))
),
Tab(
image: Image(systemName: "text.bubble.fill"),
description: "message",
content: AnyView(MessageViewMain<M>(mail: mail))
),
Tab(
image: Image(systemName: "rectangle.and.paperclip"),
description: "attachments",
content: AnyView(AttachmentsViewMain(attachments: mail.displayAttachments, dlAll: true))
)
]
}
}
}
struct Tab {
let id = UUID()
var image : Image = Image(systemName: "tag.fill")
var description : String = "---"
var content : AnyView = AnyView(Text("Still in development"))
}
#if DEBUG
struct Layout_Previews: PreviewProvider {
static let simulator = Simulators<ReadMainView<ProxyMail>>()
static let deviceNames: [String] = [
"iPhone SE",
"iPhone 11 Pro Max"
]
static var previews: some View {
simulator.previews(view: ReadMainView(mail: ProxyData.SecureMail))
}
}
#endif