Replies: 3 comments 11 replies
-
Screen.Recording.2022-10-19.at.10.13.06.mov |
Beta Was this translation helpful? Give feedback.
0 replies
-
my card view public struct DayWordCardView: View {
let store: StoreOf<DayWordCard>
@ObservedObject var viewStore: ViewStoreOf<DayWordCard>
public init(store: StoreOf<DayWordCard>) {
self.store = store
self.viewStore = ViewStore(store)
}
fileprivate func english() -> some View {
Group {
Text("\(viewStore.word.englishTitle)")
.font(.title).bold()
.foregroundColor(.black)
.padding([.top, .leading, .trailing], 16)
Text("\(viewStore.word.englishDefinition)")
.font(.body)
.foregroundColor(.black)
.padding([.bottom, .leading, .trailing], 16)
}
}
fileprivate func russian() -> some View {
Group {
Text("\(viewStore.word.russianTitle ?? "")")
.font(.title).bold()
.foregroundColor(.black)
.padding([.top, .leading, .trailing], 16)
Text("\(viewStore.word.russianDefinition ?? "")")
.font(.body)
.foregroundColor(.black)
.padding([.bottom, .leading, .trailing], 16)
}
}
fileprivate func bangla() -> some View {
Group {
Text("\(viewStore.word.banglaTitle ?? "")")
.font(.title).bold()
.foregroundColor(.black)
.padding([.top, .leading, .trailing], 16)
Text("\(viewStore.word.banglaDefinition ?? "")")
.font(.body)
.foregroundColor(.black)
.padding([.bottom, .leading, .trailing], 16)
}
}
public var body: some View {
// 1
GeometryReader { geometry in
VStack(alignment: .leading) {
if viewStore.from == "english" {
english()
Divider()
if viewStore.to == "russian" {
russian()
}
if viewStore.to == "bangla" {
bangla()
}
}
if viewStore.from == "russian" {
russian()
Divider()
if viewStore.to == "english" {
english()
}
if viewStore.to == "bangla" {
bangla()
}
}
if viewStore.from == "bangla" {
bangla()
Divider()
if viewStore.to == "english" {
english()
}
if viewStore.to == "russian" {
russian()
}
}
Spacer()
}
.padding(.bottom)
.background(Color.white)
.cornerRadius(10)
.shadow(radius: 5)
.offset(x: viewStore.translation.width, y: viewStore.translation.height)
.animation(.interactiveSpring())
.rotationEffect(
.degrees(Double(viewStore.translation.width / geometry.size.width) * 25),
anchor: .bottom
)
.gesture(
DragGesture()
.onChanged { value in
viewStore.send(.onChanged(value.translation))
}.onEnded { value in
viewStore.send(.getGesturePercentage(geometry, value))
}
)
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @saroar, the before and after code samples you originally posted does not show a direct translation from the I would try undoing that and seeing if it works. |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Before ReducerProtocal
After ReducerProtocal
Beta Was this translation helpful? Give feedback.
All reactions