Skip to content

Moved WindowViewControllable and WindowSceneViewControllable to Nodes#318

Merged
tinder-caiofonseca merged 3 commits intomainfrom
add-windowvc-andwindowscenevc-to-nodes
Mar 1, 2023
Merged

Moved WindowViewControllable and WindowSceneViewControllable to Nodes#318
tinder-caiofonseca merged 3 commits intomainfrom
add-windowvc-andwindowscenevc-to-nodes

Conversation

@tinder-caiofonseca
Copy link
Contributor

@tinder-caiofonseca tinder-caiofonseca commented Feb 23, 2023

Current versions of WindowViewControllable and WindowSceneViewControllable are in the Nodes/genesis.yml file.

Moved these two protocols to /Nodes/Sources/Nodes/WindowViewControllable and /Nodes/Sources/Nodes/WindowSceneViewControllable, and the respective conformances of UIWindow and UIWindowScene to /Nodes/Sources/Nodes/UIKit/UIWindow+WindowViewControllable and /Nodes/Sources/Nodes/UIKit/UIWindowScene+WindowSceneViewControllable.

@tinder-garricnahapetian
Copy link
Contributor

Should we put WindowViewControllable and WindowSceneViewControllable into their own files? If not, just curious why...

@tinder-caiofonseca tinder-caiofonseca force-pushed the add-windowvc-andwindowscenevc-to-nodes branch from eb8928a to 36a0305 Compare February 23, 2023 23:22

/**
* The interface used for injecting a user interface into a `Flow` instance to limit the available API,
* to avoid the use of UI frameworks within the `Flow` instance and to facilitate testing.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kept the same description as ViewControllable as it seemed appropriate. Let me know if the team has a better suggestion.


/**
* The interface used for injecting a user interface into a `Flow` instance to limit the available API,
* to avoid the use of UI frameworks within the `Flow` instance and to facilitate testing.
Copy link
Contributor Author

@tinder-caiofonseca tinder-caiofonseca Feb 23, 2023

Choose a reason for hiding this comment

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

Kept the same description as ViewControllable but I'm not sure whether it is appropriate.

Copy link
Contributor

@tinder-cfuller tinder-cfuller left a comment

Choose a reason for hiding this comment

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

Thank you for doing this 👍

Comment on lines +14 to +15
/// Presents a ``ViewControllable`` instance.
/// - Parameter viewControllable: The ``ViewControllable`` instance to present.
Copy link
Contributor

Choose a reason for hiding this comment

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

We have been placing an extra line between the various "sections" of our documentation comments for readability.

Suggested change
/// Presents a ``ViewControllable`` instance.
/// - Parameter viewControllable: The ``ViewControllable`` instance to present.
/// Presents a ``ViewControllable`` instance.
///
/// - Parameter viewControllable: The ``ViewControllable`` instance to present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, missed that! I just pressed option+command+? and let Xcode generate the skeleton for me. Will update it!


extension UIWindowScene: WindowSceneViewControllable {

/// Creates a ``WindowViewControllable`` instance and associates it with the current scene object.
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
/// Creates a ``WindowViewControllable`` instance and associates it with the current scene object.
/// Creates a ``WindowViewControllable`` instance and associates it with the scene.

Comment on lines +14 to +15
/// Creates a ``WindowViewControllable`` instance and associates it with the current scene object.
/// - Returns: The ``WindowViewControllable`` instance created.
Copy link
Contributor

Choose a reason for hiding this comment

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

We have been placing an extra line between the various "sections" of our documentation comments for readability.

Suggested change
/// Creates a ``WindowViewControllable`` instance and associates it with the current scene object.
/// - Returns: The ``WindowViewControllable`` instance created.
/// Creates a ``WindowViewControllable`` instance and associates it with the scene.
///
/// - Returns: The ``WindowViewControllable`` instance created.

import UIKit

/**
* The interface used for injecting a user interface into a `Flow` instance to limit the available API,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe something like this?

Suggested change
* The interface used for injecting a user interface into a `Flow` instance to limit the available API,
* The interface used for injecting a window scene into a `Flow` instance to limit the available API,

Comment on lines +18 to +19
/// Creates a ``WindowViewControllable`` instance.
/// - Returns: The ``WindowViewControllable`` instance created.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please see comments above.

Comment on lines +22 to +25

#else

public protocol WindowSceneViewControllable: AnyObject {}
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not need the else case here.

Suggested change
#else
public protocol WindowSceneViewControllable: AnyObject {}

import UIKit

/**
* The interface used for injecting a user interface into a `Flow` instance to limit the available API,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe something like this?

Suggested change
* The interface used for injecting a user interface into a `Flow` instance to limit the available API,
* The interface used for injecting a window into a `Flow` instance to limit the available API,

Comment on lines +18 to +19
/// Presents a ``ViewControllable`` instance.
/// - Parameter viewControllable: The ``ViewControllable`` instance to present.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please see comments above.

Comment on lines +22 to +25

#else

public protocol WindowViewControllable: AnyObject {}
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not need the else case here.

Suggested change
#else
public protocol WindowViewControllable: AnyObject {}

/// Presents a ``ViewControllable`` instance.
///
/// - Parameter viewControllable: The ``ViewControllable`` instance to present.
func present(_ viewControllable: ViewControllable)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we ultimately set window.rootViewController and call makeKeyAndVisible, I wonder if there's a better name for this method so that it sets the expectation of what conformers should do. The name sounds more like view controller present. But the implementation is more like contain or...?

Copy link
Contributor

Choose a reason for hiding this comment

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

This name is intentional. Callers of this method only care that their view controller is presented. And there is only one conformer that we need to be concerned with and it knows what to do.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be silly for a Nodes developer to think - because the name is present - that setting certain presentation properties¹ on the presented view controller would cause a change in the presentation?

¹For example, transitioningDelegate or modalPresentationStyle.

Copy link
Contributor

Choose a reason for hiding this comment

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

I cannot say whether that would be silly or not, but I do not see that as any different than calling a custom present method that overrides those properties to different values - in either case, the internal implementation of the present method has the final say on presentation.

Copy link
Contributor

@tinder-garricnahapetian tinder-garricnahapetian left a comment

Choose a reason for hiding this comment

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

Great! Perhaps we could improve the docs, but I dont have any clear suggestions yet. Also, did you test that the quick start project still works as expected after this change?

tinder-cfuller
tinder-cfuller previously approved these changes Feb 28, 2023
Copy link
Contributor

@tinder-cfuller tinder-cfuller left a comment

Choose a reason for hiding this comment

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

🚀

@tinder-caiofonseca
Copy link
Contributor Author

Great! Perhaps we could improve the docs, but I dont have any clear suggestions yet. Also, did you test that the quick start project still works as expected after this change?

Yeah, I did test the quick project pointing to Nodes locally.

Copy link
Contributor

@tinder-cfuller tinder-cfuller left a comment

Choose a reason for hiding this comment

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

🚀

@tinder-caiofonseca tinder-caiofonseca merged commit 0ae9729 into main Mar 1, 2023
@tinder-caiofonseca tinder-caiofonseca deleted the add-windowvc-andwindowscenevc-to-nodes branch March 1, 2023 17:16
@tinder-garricnahapetian
Copy link
Contributor

@tinder-caiofonseca @tinder-cfuller Our QuickStart workflow uses our local copy of genesis.yml but points to a released version of Nodes. This means that our QuickStart projects are brittle. This PR actually breaks our QuickStart since those types are removed from the genesis file but not available in 0.0.14. The workaround is to checkout 0.0.14 or modified the project to point to our local copy of Nodes. I'm not sure what the long term solution is, if any to make this more robust. Mentioning so that we can discuss.

@tinder-cfuller
Copy link
Contributor

@tinder-caiofonseca @tinder-cfuller Our QuickStart workflow uses our local copy of genesis.yml but points to a released version of Nodes. This means that our QuickStart projects are brittle. This PR actually breaks our QuickStart since those types are removed from the genesis file but not available in 0.0.14. The workaround is to checkout 0.0.14 or modified the project to point to our local copy of Nodes. I'm not sure what the long term solution is, if any to make this more robust. Mentioning so that we can discuss.

This is expected behavior. Local development requires using development versions of Nodes instead of the release version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework Framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants