Coder Social home page Coder Social logo

Proposal for API design about github-issues HOT 3 OPEN

chriseidhof avatar chriseidhof commented on August 16, 2024
Proposal for API design

from github-issues.

Comments (3)

chriseidhof avatar chriseidhof commented on August 16, 2024

I'm not sure exactly what the semantics are...

push means that the view controller will eventually be pushed? What does dismiss do? Currently, dismissing is very much implicit (which is not necessarily a good thing).

from github-issues.

nverinaud avatar nverinaud commented on August 16, 2024

push means continuing the flow normally (for NavigationController this means pushing a new vc on the stack). What I have in mind is that this function (and the others) are adapters for the custom >>> operator which permits composition. The need is to decouple the custom operator >>> from NavigationController and have it accepts adapters.

Here are 2 other examples:

// NavigationController module
let navController = NavigationController.root(screen1)
let flow = navController
>>> navController.push(screen2)
>>> navController.push(screen3)
// SplitViewController module
let splitViewController = SplitViewController.root(NavigationController.root(screen1), screen2)
let flow = splitViewController
>>> splitViewController.leftController.push(screen3)
>>> splitViewController.replaceDetailOnRight(screen4)

The idea is to have mondules with their own semantics, and make them >>> friendly.

In the example I provided in the first post, presentModally may alter the next possible transitions so that only a dismissal is possible to continue the normal flow. A custom flow may be injected though to perform a modal presentation of a navigation flow, then at the end of this flow, perform the dismissal.
It could be designed like this :

let modalFlow = root(screen10)
>>> push(screen11)
>>> push(screen12)

let flow = root(screen1)
>>> presentModally(modalFlow) // dismiss remains implicit and occurs at the end of the modal flow
>>> push(screen2)

You agree that the idea behind all of this is : view controllers act as (pure) functions and navigation is just functions composition. >>> composes functions and push, presentModally, etc, wraps screens to play well in this composition.

from github-issues.

chriseidhof avatar chriseidhof commented on August 16, 2024

Cool! I'm currently on a long trip, but will look at this when I'm back in
august. I'm all for making this entire thing not navigation-controller
dependent...

On Fri, Jun 26, 2015 at 9:26 AM, Nicolas VERINAUD [email protected]
wrote:

push means continuing the flow normally (for NavigationController this
means pushing a new vc on the stack). What I have in mind is that this
function (and the others) are adapter for the custom >>> operator which
permits composition. The need is to decouple the custom operator >>> from
NavigationController and have it accepts adapters.

Here are 2 other examples:

// NavigationController modulelet flow = NavigationController.root(screen1)

NavigationController.push(screen2)
NavigationController.push(screen3)

// SplitViewController modulelet flow = SplitViewController.root(NavigationController.root(screen1), screen2)

SplitViewController.LeftController.push(screen3)
SplitViewController.replaceDetailOnRight(screen4)

The idea is to have mondules with their own sementics, and make them >>>
friendly.

In the example I provided in the first post, presentModally may alter the
next possible transitions so that only a dismissal is possible to continue
the normal flow. A custom flow may be injected though to perform a modal
presentation of a navigation flow, then at the end of this flow, perform
the dismissal.
It could be designed like this :

let modalFlow = root(screen10)

push(screen11)
push(screen12)
let flow = root(screen1)
presentModally(modalFlow)
dismiss()
push(screen2)

You agree that the idea behind all of this is : view controllers act as
(pure) functions and navigation is just functions composition. >>>
composes functions and push wraps screens to play well in this
composition.


Reply to this email directly or view it on GitHub
#9 (comment)
.

Chris Eidhof

from github-issues.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.