get rid of additional UIHostingController. Cleanup and comments.

This commit is contained in:
David Langley
2022-10-12 14:14:25 +01:00
parent 1b4ee2082a
commit f8da168065
9 changed files with 93 additions and 56 deletions
@@ -16,12 +16,33 @@
import Foundation
// MARK: View model
enum ComposerCreateActionListViewModelResult: Equatable {
// The user selected an action
case done(ComposerCreateAction)
}
// MARK: View
struct ComposerCreateActionListViewState: BindableState {
/// The list of composer create actions to display to the user
let actions: [ComposerCreateAction]
}
@objc enum ComposerCreateAction: Int {
/// Upload a photo/video from the media library
case photoLibrary
/// Add a sticker
case stickers
/// Upload an attachment
case attachments
/// Create a Poll
case polls
/// Add a location
case location
/// Upload a photo or video from the camera
case camera
}
@@ -64,11 +85,3 @@ extension ComposerCreateAction {
}
}
}
struct ComposerCreateActionListViewState: BindableState {
let actions: [ComposerCreateAction]
}
enum ComposerCreateActionListViewModelResult: Equatable {
case done(ComposerCreateAction)
}
@@ -17,8 +17,15 @@
import SwiftUI
struct ComposerCreateActionList: View {
// MARK: - Properties
// MARK: Private
@Environment(\.theme) private var theme: ThemeSwiftUI
// MARK: Public
@ObservedObject var viewModel: ComposerCreateActionListViewModel.Context
var body: some View {
@@ -32,7 +32,6 @@ class ComposerCreateActionListViewModel: ComposerCreateActionListViewModelType,
// MARK: - Public
override func process(viewAction: ComposerCreateActionListViewAction) {
switch viewAction {
case .selectAction(let action):