-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert ConfirmationView from UIKit to SwiftUI #769
Convert ConfirmationView from UIKit to SwiftUI #769
Conversation
e3a5fcd
to
5e452cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we have discussed, lets try view model approach.
45a7410
to
5051718
Compare
5e700f7
to
3fc3927
Compare
...idgets/SecureConversations/Confirmation/SecureConversations.ConfirmationViewController.swift
Outdated
Show resolved
Hide resolved
SnapshotTests/SecureConversationsConfirmationScreenLayoutTests.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💪
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one comment about moving OrientationManager to Model.
renderProps() | ||
struct ConfirmationViewSwiftUI: View { | ||
@ObservedObject var model: Model | ||
@ObservedObject var orientation: OrientationManager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be beneficial in terms of have single source of truth to make orientation
a part of Model
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently it is not possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's how it could be achieved f448682.
And I think OrientationManager can be injected as dependency itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed dc39037
!squash |
added37
to
0946736
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated Model to use nested OrientationManager. As we discussed, we can also make OrientationManager as dependency and inject it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
!squash |
This PR is experimental, yet important first step towards transitioning to SwiftUI. ConfirmationView has been rewritten entirely in SwiftUI. The primary motivator for this PR was the frustrating nature of UIKit constraints. Key factors to keep in mind while reviewing: 1. Checkmark image has been made smaller, which was the request from the design team 2. UIFont does not translate 1:1 to SwiftUI Font, meaning the same font looks just a little big different now. But dynamic scaling works, and all our default fonts translate to expected outcome (font size, weight etc.) 3. Some approaches used in view layouts is due to the restrictions of SwiftUI 1.0 capabilities. Those can and will be upgraded in the future 4. The naming of Views, and Objects, as well as file locations in the directory are up for discussion. Everyone's input is much appreciated. 5. Prefix SwiftUI is used in lots of places due to a conflict with existing custom objects Button and Image 6. New HeaderSwiftUI view does not include all the possible configuration possibilities, as confirmations view's needs are not very demanding. So, that view can be upgraded in future. This PR also covers the ticket MOB-2488 which focuses on ADA-compliance in ConfigurationsView
54d5356
to
2f7eb17
Compare
This PR is an experimental, yet important first step towards transitioning to
SwiftUI
.ConfirmationView
has been rewritten entirely inSwiftUI
. The primary motivator for this PR was the frustrating nature of UIKit constraints.Key factors to keep in mind while reviewing:
The checkmark image has been made smaller, which was the request from the design team
UIFont
does not translate 1:1 toSwiftUI
Font, meaning the same font looks just a little bit different now. But dynamic scaling works and all our default fonts translate to the expected outcome (font size, weight, etc.)Some approaches used in view layouts are due to the restrictions of
SwiftUI
1.0 capabilities. Those can and will be upgraded in the futureThe naming of Views, and Objects, as well as file locations in the directory are up for discussion. Everyone's input is much appreciated.
Prefix
SwiftUI
is used in lots of places due to a conflict with existing custom objectsButton
andImage
The new HeaderSwiftUI view does not include all the possible configuration possibilities, as the
ConfirmationView
's needs are not very demanding. So, that view can be upgraded in the future.This PR also covers the ticket MOB-2488 which focuses on ADA compliance in
ConfirmationView
Snapshot image reference PR: https://github.com/salemove/ios-widgets-snapshots/pull/47
#I