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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Lessons learned from migrating a native iOS app to Flutter

231 点作者 PanMan超过 3 年前

30 条评论

yesimahuman超过 3 年前
You mention Ionic at the end, so I have to comment as the co-founder :)<p>The first thought is on maintenance and support from Google&#x2F;Facebook compared to someone like Ionic. One of the things people don&#x27;t think about before it&#x27;s too late is support, and Ionic is unique in mobile in that we actually make money from supporting our technology directly for customers. We have direct support available for our auth&#x2F;security&#x2F;data storage plugins, cloud services, and open source projects. We literally will respond to customer support tickets and make fixes&#x2F;patches on a weekend if we have to.<p>Is there any other company out there doing what Ionic is in mobile? You mention having issues with the Web View component, is Google or Facebook ever going to prioritize your issues? It&#x27;s not likely, they don&#x27;t have that kind of business model around their technology like Ionic does. Facebook builds RN for itself, and who knows what Google&#x27;s end-goal is with Flutter (drive GCP adoption? push its ad network?) but it&#x27;s certainly not to monetize it through dedicated support for the most significant users of it. I&#x27;m proud that the Ionic stack is the most user-aligned offering out there because we&#x27;re literally in the business of supporting and extending users of our OSS stack.<p>On the Web View side, we&#x27;ve recently shipped one of the first mobile micro-frontend projects in the ecosystem called Ionic Portals which is basically an awesome Web View component powered by our tech and expertise building web view experiences on mobile. Right now it doesn&#x27;t have RN or Flutter bindings but we are working on them this year. This has been a pretty interesting shift for us and we&#x27;re now working with traditional native teams not using the traditional Ionic stack:<p><a href="https:&#x2F;&#x2F;ionic.io&#x2F;portals" rel="nofollow">https:&#x2F;&#x2F;ionic.io&#x2F;portals</a>
评论 #29866076 未加载
评论 #29869938 未加载
评论 #29866961 未加载
josefrichter超过 3 年前
I dare to say 99% of the time I can spot a non-native app within seconds of using it. RN &amp; co. are fantastic for quick MVP. For serious product it might be actually faster to build native for both platforms. You will start hitting the limitations of RN very soon, even in core functionalities like navigation.
评论 #29864088 未加载
评论 #29863113 未加载
评论 #29863474 未加载
评论 #29869956 未加载
评论 #29865178 未加载
评论 #29863710 未加载
user249超过 3 年前
The cool thing about Flutter is that it draws components to the Skia canvas. I wasn&#x27;t even aware it had a WebView. I&#x27;m not sure why you would use Flutter if your app consists mostly of a WebView. The bugs that were found are probably not fixed because they are very low priority. You don&#x27;t save a whole lot by using a WebView in Flutter rather than building a simple shell around the iOS and Android WebView. Without knowing the details, I&#x27;d guess that the programmer is using the wrong tool for the job.
评论 #29863649 未加载
评论 #29865194 未加载
K0nserv超过 3 年前
I was heavily involved with the rollout and maintenance of React Native(RN) at my previous job. This post touches on an interesting point that has just now crystallised in my head.<p>In particular the OP writes:<p>&gt; Fortunately, I could find the bug in the library with my Swift skills, fix it within a day and even submit a patch to the owner of the repository. But I could find and fix it only because the library and my app were written in the same language, and this was a language that I was familiar with.<p>We adopted RN because we had a lot of web developers(hundreds) and wanted to enable them in contributing to our app. We explicitly didn&#x27;t make it a goal to achieve code sharing, yet we did, to the tune of 90% of the code. Overall RN was successful for us.<p>However, one thing became apparent immediately: the RN developers needed support from native teams. As soon as the RN developers hit a problem that required bridging native APIs or a bug that required platform knowledge, they end up blocked with no way to unblock themselves. Luckily we could create a team of platform experts dedicated to supporting these developers.<p>This highlights the unfortunate paradox with cross platform tech. It&#x27;s a great choice for solo developers or small startups looking to find product market fit and iterate quickly. They might be fooled into thinking that they can get by without learning the platform native methods and languages, only to find that they end up stuck when the leaky abstraction eventually leaks.<p>On the other hand, a well resourced company that can dedicate a team of platform experts as support for the cross platform developers will not suffer this problem, but is cross platform the right choice for a well resourced company? Such a company has probably already found product market fit and is better of paying the higher cost of native development to build a higher quality app.<p>A big takeaway from my RN experience is: One might expect that an RN developer can get away with knowing less about mobile than a native developer. Counter-intuitively, the opposite is true. A solo RN developer will, of course, need to know JS and React, but when the abstraction leaks they&#x27;ll also need to be comfortable with Java, Kotlin, Swift, Objective-C, the respective build systems(CocoaPods &amp; Gradle), and even C++.<p>If one considers RN&#x27;s origin, being an internal Facebook framework. It all makes sense. RN was built to allow more developers at Facebook to contribute to their apps, without requiring them to learn native technologies or languages. Of course, Facebook has the best imaginable team to support these developer, the RN team itself.
评论 #29864455 未加载
评论 #29862591 未加载
评论 #29863930 未加载
ChrisMarshallNY超过 3 年前
In the article, he mentions the need for a DOM parser dependency for his app, as Swift “does not have one.”<p><i>&gt; AEXML was needed to parse some XHTML files as the native iOS SDK does not provide a DOM parser.</i><p>I have used Foundation XML parsers[0] for many years, but they are general-purpose; not specifically modeled on DOM or HTML, which probably limits usefulness on some Web content.<p>That said, if he has control of the content (don’t know the app, so I am not sure), then there should be no reason that they couldn’t render it in XHTML, so the Foundation parser could be used reliably. In the article, he mentions that the content is XHTML. I have to assume that AEXML[1] is easier to use than the built-in parser. It uses Foundation parsing (it actually seems to be a lightweight wrapper for the built-in parser), under the hood (and seems to be a very well-written dependency).<p>So, it could be posited that he would only need one dependency for his native version, if he wanted to handle the XHTML parsing, himself.<p>Personally, I am a huge believer in native platform development, having many, many scars from the compromises required for cross-platform solutions.<p>That said, I totally understand why folks prefer cross-platform development, and can’t, in good conscience, recommend a native approach for all apps.<p>[0] <a href="https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;foundation&#x2F;archives_and_serialization&#x2F;xml_processing_and_modeling" rel="nofollow">https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;foundation&#x2F;archive...</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;tadija&#x2F;AEXML" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tadija&#x2F;AEXML</a>
npunt超过 3 年前
Worth noting this article is almost a year old now (Feb 2021), prior to Flutter 2.0 which supports web-based apps with CanvasKit. Flutter was only officially (1.0) launched 3 years ago.
评论 #29864728 未加载
intrasight超过 3 年前
I&#x27;ve been doing cross-platform development on and off for 30 years. Back in the DataViews days we had a team of two dozen professionals working on this problem and made good bank selling developer seats for about $15K each. Flash forward 30 years, and here&#x27;s what&#x27;s changed:<p>1. Users expect this stuff for free<p>2. For the most part it is, but only because the tools are being developed by big-tech and serve their interests more than yours<p>What hasn&#x27;t changed:<p>1. compile-time. I just don&#x27;t get it. Computers are like 5000x faster<p>2. cross-platform is hard and involves lots of compromises<p>3. it&#x27;s hard to make money selling tools
评论 #29872596 未加载
samwillis超过 3 年前
I looked into Flutter last year for an app I was developing that needed to use a webview for a large part of its functionality (I wanted to use a ProseMirror rich text editor). From what I could see it felt very much like webview was a neglected part of the framework; multiple incomplete community implementations, a work in progress “official” one, very long lists of bugs. There was massive problems with “contenteditable”. What the article is describing with random bugs on random devices what I saw in the bug tracker.<p>Ultimately I went with Ionic&#x2F;Capacitor and it was a great experience. Very easy to get up and running. I also experimented with combining Capacitor with NativeScript (they launched a way to use the two together) and it seemed like a brilliant way of exposing native functionality to Capacitor without having to drop all the way down to Swift&#x2F;Kotlin.<p>The only significant complaint I have about Capacitor is on iOS and a WebKit bug (Ionic can’t fix it). With WebKit on iOS if you have an overflow:scroll with a text input of any kind (basically any app you build) the text cursor or selection highlight will remain visible outside the overflow area when you scroll. So for example if you select text in an input and scroll the view so the input is under a fixed toolbar, the selection highlight or cursor is visible <i>infront</i> of the toolbar. It looks very messy, I wish Apple would fix it.<p>I would, however, definitely use Ionic&#x2F;Capacitor again, particularly if a webview was a major part of the app or as a small team targeting web and multiple mobile apps.
评论 #29863751 未加载
评论 #29862589 未加载
theHNAcct超过 3 年前
used ionic for some small stuff years ago. Kind of assumed it had lost the cross platform race considering how little I see about it. I thought React Native was the lead runner in the cross platform wars right now, anyone care to correct me or give me their take on where it&#x27;s all at?
评论 #29862091 未加载
评论 #29862033 未加载
评论 #29862632 未加载
arthur_sav超过 3 年前
I&#x27;ve built both native and cross platform apps.<p>People and especially managers think that cross platform apps will save them money&#x2F;time. However, they don&#x27;t realisize that cross platform solves one problem and creates ten.<p>The developer experience is worse, the user experience is worse and you end up with a pile of mess after 1-2 years.
评论 #29866326 未加载
评论 #29866785 未加载
pjmlp超过 3 年前
Just embrace C++ for business logic (supported natively by both SDKs) and use native views, and for most CRUD apps, mobile Web works just fine.<p>Anything else, might look enticing, however as the author points out brings lots of attrition and failures can happen at any level of the stack, thus requiring native programing knowledge to sort them out anyway.<p>So instead of being experts in two stacks, the team now needs to be expert in three stacks.
评论 #29864541 未加载
评论 #29865370 未加载
评论 #29867149 未加载
awinter-py超过 3 年前
xcode is the opposite of a tool and it is somehow getting worse with age. apple has exactly one job and apparently it&#x27;s to make xcode into a hot pile of garbage. flutter is like terraform. Is dart a good language? No, it&#x27;s a piece of shit. Most languages are. Dart, moreover, is the reason the google ads dashboard melts your laptop. But it saves you from the peril of directly gazing upon something much, much worse.<p>ios devs all have stockholm syndrome and will tell you &#x27;it&#x27;s not that bad&#x27; as they upgrade their dependencies for the 60th time to keep up with some unnecessary framework change aapl is forcing them to do because nice app store ranking, shame if something happened to it
leecommamichael超过 3 年前
Because Dart has a useful standard library, you’re still getting a much more manageable dependency tree than any JS framework could provide.
评论 #29862195 未加载
评论 #29862215 未加载
gundamdoubleO超过 3 年前
I don&#x27;t hear much about Kotlin Multiplatform when looking into cross platform mobile apps. Has anyone used it?
评论 #29861992 未加载
评论 #29861827 未加载
chubs超过 3 年前
Apologies for the naked plug, but I&#x27;ve had so many clients over the years try and fail to get cross-platform apps to work that i&#x27;m currently working to try make something that will actually work, freed from the incentives of the big companies pushing eg flutter and RN. It&#x27;s slow going however... if you think there&#x27;s a future in this kind of thing, consider asking your boss to sponsor it to help speed development? The idea is to write in a Swift-ish language, compiled to native code on both platforms, and wrap the native components, but do it in a way that learns the lessons from eg RN&#x27;s difficulties to include a sensible cross-platform navigation component. (the project is github.com&#x2F;soniclang&#x2F;sonic)
elmcrest超过 3 年前
While I agree that the bug fixing capabilities of the flutter team could be improved, it‘s still reasonable to assume that they‘re primarily caring about Google‘s issues - given Google pays the party. Still, you comparison isn‘t really a good fit IMHO because it seems you’re „just“ wrapping html content into the native ecosystem, which defeats somehow the purpose of actual native apps. And even if you‘ll only target iOS I‘d say Flutter is still a more pleasant and more productive tech to use compared to f.e. SwiftUI - of course this only applies for actual native code. Still interesting to read, thx for the article. I might modify the title though since I wouldn’t consider a html wrapper a native app you‘re migrating to flutter.
评论 #29861966 未加载
评论 #29862001 未加载
vood超过 3 年前
Can you explain why mobile developers run away from third party components?<p>I&#x27;m a full stack&#x2F;data engineer and use third party components all the time. In fact, I&#x27;d choose a popular and maintained component for the job, instead of writing it myself. I have no issues using as many components as I need. This seems like a bad practice in mobile.<p>If I encounter a bug in my dependencies, I find it, fix and send the fix to the maintainer. The same as I would do with my own code.
评论 #29863601 未加载
评论 #29863610 未加载
datavirtue超过 3 年前
I tried Flutter for two weeks before hoping out hard. Can&#x27;t put my finger on it but the combination of chaining everything into a huge nested pile of shit and....Google really turned me off. I was far more productive in Xamarin Forms.<p>&quot;Any piece of code that is not your own and that your app depends on adds to the technical debt of your app.&quot;<p>We need to start pulling in dependencies as code instead of binaries. It should become part of our project and we should remove that which we do not need and maintain or patch those parts that need it manually...one our own.<p>The number of dependencies in projects cause a great deal of bloat, cross-cutting nightmares, and unending security vulnerabilities that make us desperately seek support in the form of new binaries from unpaid contributors. It is not professional, dignified, or safe.<p>If you need StringUtils.isEmpty you should not be pulling in the apache commons jar. Just clip the code you need and squirrel it away in your project.
davidkhess超过 3 年前
I find Qt&#x2F;QML for cross-platform mobile applications to be a great solution. It uses the same basic architecture as Flutter – they both do not use native widgets and instead draw the entire UI on a blank graphics canvas. I think that approach preserves the most code between platforms and reduces the kinds of presentation hitches that HTML web view and hybrid native widget approaches can run into.<p>In relation to the particular problems of technical debt related to third party modules mentioned in this article, QML rides on top of Qt which is a 26 year old C++ cross-platform toolkit with a lot of mature technology in it. I.e. there is a lot more &quot;batteries included&quot;.<p>There are still plenty of times you have to &quot;go native&quot; to integrate something Qt doesn&#x27;t cover but it apparently isn&#x27;t as often as with Flutter.
评论 #29865980 未加载
timsneath超过 3 年前
Tim here from the Flutter team; thanks for the post. There are some good points here: in particular, that no single framework or toolkit is the &quot;holy grail&quot;. We all live in a world of trade-offs, and anyone who claims that any single technology is the panacea for all problems is selling a mirage.<p>I really appreciate the constructive critique in the article: both the good (getting an app up and running quickly), and the more painful to read (&quot;Flutter&#x27;s ability to execute leads a lot to be desired, particularly on iOS&quot;). While Google is the primary sponsor for Flutter, it&#x27;s an open source project, and so as ever having reproducible bug reports and ideally pull requests is how we make it better.<p>The raison d&#x27;être for Flutter is simple: we don&#x27;t think you should have to write the same code six times for your app to reach each major desktop, mobile and web platform. This abstraction is not free, but we think it&#x27;s worth the bet, and there are some cool apps being built with Flutter, plenty of which have been awarded accolades like Apple Editor&#x27;s Choice. We&#x27;re not the solution for every app out there, but there are startups who don&#x27;t have the developer team size to build multiple apps but can benefit from Flutter, as well as larger companies for whom Flutter lets them unify their app development team behind a single codebase.<p>A few quick comments I wanted to make:<p>- Yes, we have a large number of open issues -- over 9,000 at the last count, but not all issues are bugs. We&#x27;re somewhat unique in bringing together tools, packages, framework and engine issues into a single database, also merging feature requests, bugs and even API doc requests together. Our general philosophy is that it&#x27;s better to have it out in the open rather than (for example) to prematurely close issues that we don&#x27;t plan to work on ourselves. We&#x27;re also not unique as a large open source project in having lots of open issues (also see projects like PyTorch, Rust and VSCode). Lastly, it&#x27;s important to count the number of issues _closed_, which is over 50,000, representing bugs fixed, new features implemented, and so on. We document the triage process here: <a href="https:&#x2F;&#x2F;github.com&#x2F;flutter&#x2F;flutter&#x2F;wiki&#x2F;Triage" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;flutter&#x2F;flutter&#x2F;wiki&#x2F;Triage</a><p>- I&#x27;m surprised that the author considers packages an inevitable weakness. We&#x27;ve deliberately kept the core of Flutter relatively small, because it enables us to iterate on packages at their own pace. We could have taken the approach of building things like XML parsing, HTTP servers, geolocation and so on into the core of Flutter, but it wouldn&#x27;t automatically make them more robust. With a package model, we can fix a specific issue without requiring a whole release cycle for every part of Flutter. Over the last year since the author wrote this article, our package maturity has greatly improved, and I&#x27;d be interested to know whether this is noticeable.<p>- Lastly, the underlying fear expressed in the article seems to be that Google will at some point just give up with Flutter. I understand this, since we don&#x27;t have an immaculate reputation in terms of long-term support. I will say that this question doesn&#x27;t come up internally with our stakeholders, though. There are over 400,000 apps in the Play Store that use Flutter; about 1,000 Google engineers building highly-strategic products using Flutter; and a healthy ads revenue from apps that use Flutter. The project more than pays for itself, and I can&#x27;t honestly envisage any scenario in the next decade where Google would choose to squander all that.<p>Keep the feedback coming: we&#x27;re listening.
评论 #29876325 未加载
sysOpOpPERAND超过 3 年前
i love working with flutter and dart. really hoping the job market opens up more for those. one major annoyance for me is having to create a class to handle the data from a json.<p>i would love to see dot notation access to keys like how javascript handles json, it turns it automatically into an object after using .json()<p>but overall i enjoy working with it and it is always good to see posts popping up on HN about it
wiradikusuma超过 3 年前
&quot;After some research.. ..I decided to give it a go.&quot;<p>Hmm.. From my experience, every time I pick a new language &#x2F; framework, always always always do proof-of-concept for <i>ALL</i> features you might need: camera, GPS, webview, deeplinking, etc. Don&#x27;t want surprises.<p>Esp. if you already have an <i>existing</i> app, you should have a clear visibility of what&#x27;s needed.
zerr超过 3 年前
As a side note, for some reason, cross-platform frameworks such as Flutter are quite popular in developing countries.
评论 #29864863 未加载
评论 #29876929 未加载
egberts1超过 3 年前
And the holy grail of writing an app for all mobile platforms shall remains … illusive (and elusive as well).
shaan7超过 3 年前
&gt; Any piece of code that is not your own and that your app depends on adds to the technical debt of your app.<p>I find this ^ strange. There is a difference between using a library and technical debt. We use libraries so that we do not have to solve a problem that someone already has. Tech debt is a &quot;shortcut&quot; that you took when implementing a system because $deadlines&#x2F;$budget&#x2F;etc. An example might be calling a binary to do something for a PoC because interacting with a library will be more effort.<p>Using libraries is a <i>good thing</i>, it would be sad* if all of us keep solving the same problems over and over again. Tech debt, on the other hand, is debt, something you want to avoid as much as you can.<p>* personally I find having to re-solve solved problems one of the most frustrating things when programming, it takes away all the joy
评论 #29863467 未加载
评论 #29862785 未加载
评论 #29862877 未加载
asdev超过 3 年前
it&#x27;s amazing to me how crappy the mobile development experience is in 2022 with any technology(React Native, Flutter, native)
Aulig超过 3 年前
I&#x27;ve also encountered a couple bugs in the webview package. But I feel like the support has been getting better.
torstenvl超过 3 年前
<a href="https:&#x2F;&#x2F;archive.fo&#x2F;XpChE" rel="nofollow">https:&#x2F;&#x2F;archive.fo&#x2F;XpChE</a>
intrasight超过 3 年前
Honest question to those who&#x27;ve been there and don that. What&#x27;s the right solution path for a very small (3-4 people) team to build a relatively polished mobile app? Options I see are:<p>1. Native iOS followed by Native Android<p>2. Flutter<p>3. React Native<p>4. Capacitor<p>5. Microsoft toolkit of the day<p>I may soon embark on such a task with such a small team. I am leaning towards #1.
评论 #29864800 未加载
axegon_超过 3 年前
Disclosure: never done any iOS development, only android as a hobby&#x2F;personal projects. I&#x27;ll be first to admit I have always hated Java with a passion. So when Kotlin came along I was thrilled. It still piggybacked on the wretched and slow as hell JVM but at least the syntax was pleasant to work with and didn&#x27;t offer one way to get from A to B which involved 3 abstract classes, 5 factories and two ultra wide monitors to fit your class names. Flutter came out iirc about a year later and I was on a bus going to a friends&#x27;s house on the other end of the country. I pulled out my laptop and spent the next 4 hours fiddling with it. And even though it was young and far not mature, I have to admit, I enjoyed it and managed to make a fully functioning app in that time. I had fiddled with dart a bit while I was still in university iirc, just because it was a promising alternative to js(which I also hate with a passion). And even with my rusty memories of it, I felt right at home. It is true, flutter gives you a far greater flexibility when you are building a UI than any of the native solutions. But I feel like the author(s) of the article made one fundamental mistake - depending heavily on components developed by other people. The truth is, flutter is a good choice when you want to do a custom UI at a relatively low price(in terms of how much time and effort you need to spend on it, compared to the native solutions). In addition for cross platform development, dart, unlike javascript, is entirely predictable.<p>BUT! If you are working on a complex application which requires a lot of resources and clever ways to keep a low footprint, you might be better off with the native solutions(even though dart has a very mature ffi). I guess a similar comparison would be something like tinygo and micro python for embedded development - good enough for simple things, but anything beyond that, sack them and stick to C&#x2F;C++.