1
0
mirror of https://github.com/metabolist/metatext synced 2024-12-24 17:00:50 +01:00
metatext-app-ios-iphone-ipad/iOS/Views/IdentitiesView.swift
2020-08-07 23:01:45 -07:00

37 lines
1.1 KiB
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) {
withAnimation {
rootViewModel.newIdentitySelected(id: identity.id)
}
}
}
}
}
}
}
struct IdentitiesView_Previews: PreviewProvider {
static var previews: some View {
IdentitiesView(viewModel: .development)
.environmentObject(RootViewModel.development)
}
}