{"id":29179,"date":"2020-06-08T15:40:29","date_gmt":"2020-06-08T19:40:29","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=29179"},"modified":"2020-08-27T15:31:21","modified_gmt":"2020-08-27T19:31:21","slug":"why-textview-is-my-swiftui-canary","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2020\/06\/08\/why-textview-is-my-swiftui-canary\/","title":{"rendered":"Why TextView Is My SwiftUI Canary"},"content":{"rendered":"<p><a href=\"https:\/\/appdecentral.com\/2020\/06\/07\/why-textview-is-my-swiftui-canary\/\">Drew McCormack<\/a> (<a href=\"https:\/\/twitter.com\/drewmccormack\/status\/1269616758798852098\">tweet<\/a>):<\/p>\n<blockquote cite=\"https:\/\/appdecentral.com\/2020\/06\/07\/why-textview-is-my-swiftui-canary\/\">\n<p>One of the big questions on my mind is how well the fully declarative approach scales to complex apps. You can already build quite reasonable portal apps for your favorite web service with SwiftUI, which is 90% of the iOS app market, but I am much more interested in the other 10%. Can you build an advanced iOS app or serious macOS app with SwiftUI? Could you develop an app like Keynote or Xcode using SwiftUI?<\/p>\n<p>[&#8230;]<\/p>\n<p>This process is fast for a few standard views, but there are bigger challenges looming. For example, take a large array of values that you want to present in a <code>List<\/code>. We encountered some serious performance issues when updating data in such a <code>List<\/code>, as SwiftUI would attempt to diff thousands of <code>View<\/code> nodes. You could restructure your UI in order to avoid such large lists, but that is a bit of a cop out, because the technologies SwiftUI is designed to supplant <em>can<\/em> handle such large lists.<\/p>\n<p>The problem is perhaps even more apparent in a text view. We briefly saw a <code>TextView<\/code> type appear during the SwiftUI beta in 2019, but it didn&rsquo;t make the final release.<\/p>\n<\/blockquote>\n<p>There&rsquo;s also no outline view or Mac-style table view.<\/p>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/05\/14\/wwdc-2020-wishlists\/\">WWDC 2020 Wishlists<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/01\/31\/swiftui-for-mac\/\">SwiftUI for Mac<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2019\/12\/13\/swiftui-deal-breakers\/\">SwiftUI Deal-Breakers<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2019\/10\/22\/swiftui-is-still-the-future\/\">SwiftUI Is Still the Future<\/a><\/li>\n<\/ul>\n\n<p id=\"why-textview-is-my-swiftui-canary-update-2020-08-27\">Update (2020-08-27): <a href=\"https:\/\/ds9soft.com\/blog\/2020\/06\/swiftui-suitability-for-macos-app-development\/\">Sebasti&aacute;n Ben&iacute;tez<\/a>:<\/p>\n<blockquote cite=\"https:\/\/ds9soft.com\/blog\/2020\/06\/swiftui-suitability-for-macos-app-development\/\"><p>I heard many other people are having problems with other advanced AppKit controls, such as NSTextView, NSTableView, NSOutlineView. Any non-trivial Mac application is bound to use one of these, so if you were to use them, you either wrap them in a representable + coordinator or go the traditional way and build with SwiftUI around it.<\/p>\n<p>Despite all of this, I have no plans to abandon SwiftUI.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/lucvandal\/status\/1284216979407155200\">Luc Vandal<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/lucvandal\/status\/1284216979407155200\">\n<p>As much as I enjoy SwiftUI, it becomes quickly frustrating by its limitations and having to resort to UI\/NSViewRepresentable for trivial things such as making a text field first responder.<\/p>\n<p>SwiftUI is still a few years from being a real alternative to UIKit\/AppKit.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/vincode_io\/status\/1284155608090980354\">Maurice Parker<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/vincode_io\/status\/1284155608090980354\">\n<p>SwiftUI List performance on AppKit is very bad.  We did a version of our Timeline (the middle view) that used LazyVStack and it was fast.  We need List for animations and other things, so hopefully the SwiftUI team gets things tuned on AppKit.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/Freerunnering\/status\/1279268171086790656\">Kyle Howells<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/Freerunnering\/status\/1279268171086790656\">\n<p>The part of the SwiftUI story I&rsquo;m waiting for is how to build SwiftUI.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/arroz\/status\/1279303649487810560\">Arroz<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/arroz\/status\/1279303649487810560\">\n<p>One of the problems of SwiftUI is you&rsquo;re not building views. The View name is misleading. You&rsquo;re building a description of something that somehow is turned into views. Completely out of your control.<\/p>\n<p>So you&rsquo;re completely limited to what the DSL allows you to express. Unlike AppKit\/UIKit, you can&rsquo;t actually BUILD something. You can only pick from a catalog the parts you want and assemble them according to the instructions.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Drew McCormack (tweet): One of the big questions on my mind is how well the fully declarative approach scales to complex apps. You can already build quite reasonable portal apps for your favorite web service with SwiftUI, which is 90% of the iOS app market, but I am much more interested in the other 10%. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2020-06-08T19:40:32Z","apple_news_api_id":"e8e1647d-9634-4a50-bebb-7b261523c1e2","apple_news_api_modified_at":"2020-08-27T19:31:25Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAQ==","apple_news_api_share_url":"https:\/\/apple.news\/A6OFkfZY0SlC-u3smFSPB4g","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[1615,69,30,1666,71,901,1812],"class_list":["post-29179","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-agenda","tag-cocoa","tag-mac","tag-macos-10-15","tag-programming","tag-swift-programming-language","tag-swiftui"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/29179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=29179"}],"version-history":[{"count":3,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/29179\/revisions"}],"predecessor-version":[{"id":29917,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/29179\/revisions\/29917"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=29179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=29179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=29179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}