TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Routable, an in-app URL router for iOS and Android

100 点作者 10char大约 12 年前

9 条评论

realrocker大约 12 年前
Very cool. But please don't use it. The de-facto architecture design proposed by the Android team is to use fragments for view separation. In my own app development workflow, I have not used multiple activity design for a really long time now. This is what you lose with external routing: 1. Better multiple screen size support: By housing all the fragments in one activity, you have control to hide/show/re-size fragments according to need since you have now have the fragment stack data in one activity. An external router doesn't make sense now, since the internal routing would still need to be handled by the activity. And if you write a router even for the internal stuff, then you need to address other concerns such as: backstack and bundles. 2. Single Top Activities: The Android app stack may have multiple instances of the same activity. When you route with a data path (user/id/1) which activity are you referring to? The Intent and PendingIntent classes have been developed over the years to face such weird idiosyncrasies of the platform. 3. Action Modes: The action mode api helps to create contextual actions. It gives you a nice separation of concern through callbacks. This glues the activity with fragments well. In two calls you setup a fragment and its contextual menus. With external routing you lose that or you handle it with more glue code.<p>I agree there are some cosmetic advantages through external routing, but develop any non-trivial Android app and you will find out, it's not always a good idea to fight the framework. In some cases maybe it is, for e.g this cool project: <a href="https://github.com/mitmel/SimpleContentProvider" rel="nofollow">https://github.com/mitmel/SimpleContentProvider</a>. Java is already too verbose. Wiring an external router means handling a lot of concerns yourself. Not cool.
rogerbinns大约 12 年前
What exactly is wrong with using Intents in Android? They would seem to be a far better mechanism for Android code, and also interoperate with the rest of the system (eg notifications).
评论 #5505201 未加载
评论 #5505066 未加载
评论 #5505555 未加载
niggler大约 12 年前
"Long ago, there was an iOS library known as Three20."<p>What exactly happened with it? The website (<a href="http://three20.info/" rel="nofollow">http://three20.info/</a>) seems to suggest that it hasnt been touched in years.
评论 #5505003 未加载
aaronbrethorst大约 12 年前
I wrote something similar a couple years back: <a href="https://github.com/aaronbrethorst/abrouter" rel="nofollow">https://github.com/aaronbrethorst/abrouter</a>
seivan大约 12 年前
The API is very similar to the one Aaron Brethorts (cocoacontrols) wrote. Seems pretty cool though, but I am not sure how it handles deep hierarchies of vc´s.<p>What if I route to a particular controller, what happens when I tap &#60;back/dismiss&#62; or how about segue animations?<p>Not complaining! Just curious. Will give it a shot now.
评论 #5505090 未加载
rmoriz大约 12 年前
Checkout <a href="https://github.com/joeldev/JLRoutes" rel="nofollow">https://github.com/joeldev/JLRoutes</a> by a former Apple iOS employee.
bound008大约 12 年前
I have been building something similar for iOS called RESTMagic that does this automatically using the URL structure of your API.<p><a href="http://RESTMagic.org" rel="nofollow">http://RESTMagic.org</a> <a href="http://github.com/RESTMagic/RESTMagic" rel="nofollow">http://github.com/RESTMagic/RESTMagic</a><p>If you build a twitter app (such as the example one with the project) and try and open a URL, the app handles it and opens the right view controller, if it doesn't exist it tries to get the json and match it with an HTML template. If the server just returns HTML is presents that. Magic.<p>The app even looks at your obj-c class prefix and looks if you made a subclass of the main view used for presenting HTML and uses that instead system wide.<p>Haven't posted it here yet but would love feedback, email address is on the RESTMagic page.
tejaswiy大约 12 年前
How do I do stuff like this?<p>-(id) initWithUser:(User *) user {<p>}<p>instead of passing around primitive data types?
vgrichina大约 12 年前
Why completely ignore storyboards and XIBs on iOS?