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

Add a ContainerViewController subspec #2

Merged
merged 6 commits into from Feb 2, 2018

Conversation

wmcginty
Copy link
Contributor

@wmcginty wmcginty commented Jan 2, 2018

Added a container view controller. Doesn't present any visuals for navigation of it's own, just the child view controllers. Can probably write some unit tests for parts of the functionality.

@wmcginty
Copy link
Contributor Author

@BottleRocketStudios/ios-developers Please take a look at this when you get a chance.

Copy link
Contributor

@ganttastic ganttastic left a 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. ContainerViewController looks nice!

Copy link
Contributor

@tylermilner tylermilner left a comment

Choose a reason for hiding this comment

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

Looks cool! Just a few minor fixes needed I think.

destination = destinationViewController
completion = completionHandler

viewControllers = [UITransitionContextViewControllerKey.from : sourceViewController,
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 can use type inference here, right?

viewControllers = [.from : sourceViewController,
                   .to : destinationViewController]

}

var targetTransform: CGAffineTransform {
return CGAffineTransform.identity
Copy link
Contributor

Choose a reason for hiding this comment

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

Can use type inference here as well.

return .identity


//MARK: Properties
public var children: [Child] = []
public private(set) var isTransitioning: Bool = false
Copy link
Contributor

Choose a reason for hiding this comment

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

public private?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Public getter, private setter. Not sure exactly how valuable it is to an outside component - but assumed it couldn't hurt.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I forgot this is a framework so it just looked like a typo at first.

transition(to: child.viewController)
}

open func transitionToController(withTitle title: String) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an API we want as part of this library? Since titles are susceptible to changing from UX, it seems like we wouldn't be doing anyone a service if we gave them the option to use this in production code. We may want to declare this part of the extension in the Example code instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point. Will change.

}

func finishTransitioning(from source: UIViewController?, to destination: UIViewController, animated: Bool) {
source.map { removeSourceControllerFromContainer($0, animated: animated) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice uses of map and flatMap in here!

@wmcginty
Copy link
Contributor Author

wmcginty commented Feb 2, 2018

@tylermilner Requested changes have been made

@tylermilner tylermilner merged commit b1ac9fe into master Feb 2, 2018
@wmcginty wmcginty deleted the containerViewController branch February 14, 2018 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants