Skip to content
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

Frames SDK API specs comments #166

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

ehab-al-cko
Copy link
Contributor

Proposed changes

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.

Screenshot 2022-06-08 at 6 41 37 pm

@ehab-al-cko ehab-al-cko changed the title Clean code API specs comments Jun 8, 2022
@ehab-al-cko ehab-al-cko changed the title API specs comments Frames SDK API specs comments Jun 8, 2022
@@ -18,7 +18,7 @@ public struct BillingFormFactory {
.phoneNumber(DefaultBillingFormPhoneNumberCellStyle())]
}

static func getBillingFormViewController(style: BillingFormStyle?, data: BillingForm?, delegate: BillingFormViewModelDelegate) -> (BillingFormViewModelDelegate?, UINavigationController)? {
static func getBillingFormViewController(style: BillingFormStyle?, data: BillingForm?, delegate: BillingFormViewModelDelegate) -> (deleagte: BillingFormViewModelDelegate?, navigationController: UINavigationController)? {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
static func getBillingFormViewController(style: BillingFormStyle?, data: BillingForm?, delegate: BillingFormViewModelDelegate) -> (deleagte: BillingFormViewModelDelegate?, navigationController: UINavigationController)? {
static func getBillingFormViewController(style: BillingFormStyle?, data: BillingForm?, delegate: BillingFormViewModelDelegate) -> (delegate: BillingFormViewModelDelegate?, navigationController: UINavigationController)? {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm late for this, but why are we passing in a delegate and then also giving it back out. Doesn't the caller already own it since it provided it in the first place?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @alex-ioja-yang-cko , looking at the code i see getBillingFormViewController takes in a delegate which is of the view controller where the billingVC is presented. It is then passed to DefaultBillingFormViewModel where it has the delegate methods and sets this delegate.

But from the sample app when we call getBillingFormViewController as merchant it is never used inside the VC itself ( when returned ) and we can get rid of the returned delegate if we are not using it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should address this and/or fix the typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a comment on old PR to expose delegate

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you misinterpreted what that comment asked for. It wasn't for a delegate to be returned alongside the VC, it wouldn't make sense to if you have no need for it.

I was saying that the common syntax is to assign the delegate after the object has been created, not during the initialisation. The common way to see delegate being assigned is in patterns of:

let object = MyObject()
object.delegate = myDelegate

rather than

let object = MyObject(delegate: myDelegate)

There are some nuances to why that is, which are not applicable here, but make it a more regular occurance when navigating the code. I would have rather you rejected this idea than add this code change :).

Copy link
Contributor

@deepesh-vasthimal-cko deepesh-vasthimal-cko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM one comment about the delegate which is returned never used for getBillingFormViewController, Please have a look.

Copy link
Contributor

@harry-brown-cko harry-brown-cko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one comment

@@ -18,7 +18,7 @@ public struct BillingFormFactory {
.phoneNumber(DefaultBillingFormPhoneNumberCellStyle())]
}

static func getBillingFormViewController(style: BillingFormStyle?, data: BillingForm?, delegate: BillingFormViewModelDelegate) -> (BillingFormViewModelDelegate?, UINavigationController)? {
static func getBillingFormViewController(style: BillingFormStyle?, data: BillingForm?, delegate: BillingFormViewModelDelegate) -> (deleagte: BillingFormViewModelDelegate?, navigationController: UINavigationController)? {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should address this and/or fix the typo

Copy link
Contributor

@melting-snowman melting-snowman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think that excess complication in the tuple being returned should get removed, but don't mind if done separately, up to you.

@ehab-al-cko ehab-al-cko merged commit c12274e into release/4.0.0_RC Jun 9, 2022
@ehab-al-cko ehab-al-cko deleted the address_frames_api_specs_comments branch June 9, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants