1
0
mirror of https://github.com/metabolist/metatext synced 2025-01-24 08:22:54 +01:00
metatext-app-ios-iphone-ipad/Shared/Views/IdentitiesView.swift
2020-08-05 04:48:50 -07:00

35 lines
1014 B
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import SwiftUI
struct IdentitiesView: View {
@StateObject var viewModel: IdentitiesViewModel
@EnvironmentObject var rootViewModel: RootViewModel
var body: some View {
Form {
Section {
NavigationLink(
destination: AddIdentityView(viewModel: rootViewModel.addIdentityViewModel()),
label: {
Label("add new account", systemImage: "plus")
})
}
Section {
List(viewModel.identities) { identity in
Button(identity.handle) {
rootViewModel.newIdentitySelected(id: identity.id)
}
}
}
}
}
}
struct IdentitiesView_Previews: PreviewProvider {
static var previews: some View {
IdentitiesView(viewModel: .development)
.environmentObject(RootViewModel.development)
}
}