惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
K
Kaspersky official blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog
aimingoo的专栏
aimingoo的专栏
M
MIT News - Artificial intelligence
小众软件
小众软件
云风的 BLOG
云风的 BLOG
腾讯CDC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
Stack Overflow Blog
Stack Overflow Blog
量子位
S
Secure Thoughts
G
GRAHAM CLULEY
C
CXSECURITY Database RSS Feed - CXSecurity.com
人人都是产品经理
人人都是产品经理
雷峰网
雷峰网
T
Threat Research - Cisco Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
G
Google Developers Blog
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
有赞技术团队
有赞技术团队
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Martin Fowler
Martin Fowler
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
C
Cisco Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 聂微东
宝玉的分享
宝玉的分享
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
Forbes - Security
Forbes - Security
Engineering at Meta
Engineering at Meta
S
Security Affairs
Help Net Security
Help Net Security
博客园 - 三生石上(FineUI控件)
AWS News Blog
AWS News Blog
博客园 - 叶小钗
Recent Commits to openclaw:main
Recent Commits to openclaw:main
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
Project Zero
Project Zero
H
Heimdal Security Blog
W
WeLiveSecurity
C
Check Point Blog

Ben Frain

So, you want a React modal that uses the <dialog> element and transitions in AND out? Scroll indicators on tables with background colours using animation-timeline Review: SoundPEATS Clip1 Open ear clip-on headphones VS Code – highlight just the active indent guide Review: MoErgo Go60, a split ergonomic and fully programmable keyboard Review: Kinesis mWave mechanical ergonomic and programmable keyboard iOS26 Safari theme-color/tab-tinting with fixed position elements is a mess New Book: Responsive Web Design with HTML5 and CSS, 5th Edition Use @supports with a proxy feature/value for features you can’t test for (@starting-style) First adventures in View Transitions Review: Benq Screenbar Pro and Halo lightbars. The kit you never knew you needed! Center items in a container, and make then left aligned when they overflow A single element CSS donut timer/countdown timer, that can sit on any background Review: Open Ear Headphones – Bose Open Ultra v Huawei FreeClip In search of the perfect autocomplete for CSS Managing multiple versions of node, without NVM or additional tools Review: Keychron Q14 Max Alice 96 Key mechanical keyboard NEW VIDEO COURSE: Responsive Web Design with HTML5 and CSS Is CSS Grid really slower than Flexbox? Review: Advantage360 Pro Signature Edition 2024 mechanical ergonomic keyboard More Keys or Fewer Keys for mechanical keyboards Yes! You can use position: sticky and overflow together Neovim – how to do project-wide find and replace? Review: Keyboardio Model 100, split, wooden, mechanical keyboard How to create rounded gradient borders with any background in CSS How to get equal size icons in the cmp completion menu of Neovim with Kitty terminal Review: Dygma Defy, split, mechanical, programmable ergonomic keyboard What’s the best way to reset WAAPI chained animations? Using CSS @property inside shadowRoot (web components) workaround Dynamically create a ref for items when iterating over them in lit.dev templates Selecting and pausing running animations in Lit Web Components New Web APIs — a popover on top of a dialog element can’t be interacted with? Review: ZSA Voyager, split, mechanical keyboard Russel Brand, narcissism, and a sadly common pattern… When it comes to text editors, I feel like Goldilocks Simple settings for writing and converting markdown with Sublime Text Review: The ZSA Platform tenting kit for the Moonlander keyboard Logitech MX Master 3/3s scroll wheel fix Building a line graph with CSS clip-mask Review: Dell 6K 32″ Monitor U3224KBA I broke my keyboard! Swapping the key switches in the Kinesis Advantage360 Pro HUGE macOS Productivity boost: Set-up simple, keyboard only, instant App switching and arrangement Adding to $PATH for a central location for Neovim/NPM tools Neovim Power Tips: Volume 2 Review: MoErgo Glove80, split, wireless, columnar ergonomic keyboard with RGB Review: Kinesis Advantage 360 Pro — split ergo mechanical keyboard Review: Dactyl Manuform – an ergonomic, custom built mechanical keyboard How to animate along an SVG path at the same time the path animates? Getting the context of Web Components (lit)
Struggling to learn SwiftUI
Ben Frain · 2024-02-15 · via Ben Frain

For the past ten days or so, I have been trying to gain some basic competency with SwiftUI.

I have found it hard. Very hard. But I finally feel there is a sliver of light in my comprehension. Just enough to give me the confidence to write this here, thinking there may be more posts on SwiftUI to come.

Why so hard

My aims for SwiftUI are the same as they are with web technologies; principally, to make high-fidelity prototypes to test out designs. SwiftUI will just give me another medium to work with, and hopefully negate the need to make prototypes for native app features in a different medium; web tech.

And so I set out watching and reading and trying to get my head around SwiftUI.

At the outset, I was very encouraged. Conceptually, SwiftUI, surely by no mistake, is very reminiscent of web frameworks like lit.dev and React. Something I am comfortable with.

Components are essentially ‘Views’ in Swift parlance, and in SwiftUI, you pass state, or reference state from some global location, and the declarative View that you have written updates to the new state.

So, with such familiar conceptual underpinnings, I don’t know why I have found it so hard to start to use SwiftUI.

“…I’m too old for this shit”

However, a few days in, the thought crossed my mind that maybe, like the fact my body can no longer manage a full game of football, my mind simply lacks the elasticity to learn new things?

I was watching and watching, reading and reading, trying to make things, just simple things, any thing, in Xcode and it just was not happening.

A kind of fear gripped me.

Writing the correct syntax seemed like simply memorizing some bizarre magic incantation, with no basis in logic. Add to that, that, unlike on the web, where techniques from the past live for all eternity, in SwiftUI, at Apple’s convenience, they are simply removed. So something that reasonably worked in 2021, does absolutely not work in 2024. Or gives you so much warning in the editor, you couldn’t in good faith leave it in.

For example, good ol’ ChatGPT would keep telling me with insistence I should use NavigationView which is simply not a thing in later iOS versions.

Frustration heaped onto frustration, as things like reading in a JSON file to iterate over it in the UI remained unfathomable to me.

I spoke to colleagues, they suggested treating it like first experiences with the web, and just get images in and see if you could navigate between them as faux ‘pages’ of the app rather than make pages with ‘real’ content.

I subsequently scaled back my already humble ambitions further.

More days of fruitless labour followed, every step forward presented two steps back as some new blocker revealed itself. I started to write up each new issue and ask the question on the ‘Hacking with Swift’ forums (I have pretty much given up on Stack Overflow as it seems near impossible to ask any question that isn’t immediately shut down as a ‘duplicate’).

I was going to bed each evening with my head ‘humming’, and waking up with a sense of dread.

I had looked at SwiftUI a couple of years back and been equally frustrated and ultimately retreated back to the warm embrace of web technologies. However, this time, I didn’t feel that retreating was an option. But I was 100% not having a fun time.

Something changed

Then yesterday, something altered, subtle but noticeable. I had started to get an intuition for what would work and what wouldn’t. To some degree perhaps, a sense of what SwiftUI was expecting with the simplest of interactions.

Let me be clear. These are the very beginning of steps along a journey. Absolute basic stuff. But I at least feel I am starting to occasionally shuffle my progress forward, in the belief I will one day walk.

At the outset there wasn’t a hole in my knowledge, there was NO knowledge. Now, I at least feel there is a merely a gaping chasm to cross.