Giter Site home page Giter Site logo

jlroutesinswift's Introduction

JLRoutesInSwift

JLRoutes在Swift中的使用

最近因为Flutter中的路由缘故,开始反向学习iOS中的路由了. 但是相比较Flutter中官方支持,并且在顺传值和反向传值的各种便利,iOS的路由都是第三方,而且跟多的场景适用于顺传值,但是对于反向传值,基本上是没有没可能的.

JLRoutesDemo我通过这个Demo中学习思路,并进行简化与封装,通过协议的方式更好的进行顺传路由的功能.

并且原Demo中在openUrl函数中,会出现再次调用下面的方法:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

回导致递归调用而进入死循环,而这种情况主要是在外部通过浏览器或者是通过其他App打开该App时候产生.

目前大概就是这么多,个人认为iOS中的路由框架,其实最好的使用场景是推送/网页打开/其他App打开.

我更新了在目标路由关闭后,回调数据的方法,并且行之有效,这样的话,路由顺传值与反向传值的功能都满足了,但是由于没有await与async,于是展示出来的就是闭包,理解起来不是特别好.

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.