Skip to content

Commit

Permalink
feat: image, note 저장 로직 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
mooyoung2309 committed Sep 16, 2023
1 parent 210d4d4 commit 09ae8ef
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public struct AddTradeStore: Reducer {
self.price = trade.price ?? 0
self.selectedDate = trade.date
self.selectedTradeSide = trade.side ?? .buy
self.note = trade.note ?? ""
self.images = trade.images
}
}

Expand Down Expand Up @@ -117,7 +119,8 @@ public struct AddTradeStore: Reducer {
side: state.selectedTradeSide,
price: state.price,
volume: state.count,
images: [], note: "",
images: state.images,
note: state.note,
date: state.selectedDate,
ticker: state.ticker
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ import ToolinderShared

public struct AddTradeView: View {
let store: StoreOf<AddTradeStore>
@State var images: [UIImage] = []

public init(store: StoreOf<AddTradeStore>) {
self.store = store
}

public var body: some View {
WithViewStore(self.store, observe: { $0 }) { viewStore in
VStack(spacing: 20) {
headerView(viewStore: viewStore)
.padding(.top)

pickerView(viewStore: viewStore)
.padding(.bottom)

inputView(viewStore: viewStore)

Spacer()

saveButtonView(viewStore: viewStore)
ScrollView {
VStack(spacing: 20) {
headerView(viewStore: viewStore)
.padding(.top)

pickerView(viewStore: viewStore)
.padding(.bottom)

inputView(viewStore: viewStore)

Spacer()

saveButtonView(viewStore: viewStore)
}
}
.padding()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public struct ImageItem: View {
if let uiImage = UIImage(data: imageData) {
Image(uiImage: uiImage)
.resizable()
.frame(width: 48)
.aspectRatio(contentMode: .fill)
.frame(width: 56, height: 56)
}
}
.background(Color(uiColor: .systemGray6))
Expand Down

0 comments on commit 09ae8ef

Please sign in to comment.