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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: I made a Wordle clone on an iPad using the new Swift Playgrounds 4

2 点作者 jkirsteins将近 3 年前

1 comment

jkirsteins将近 3 年前
I was very excited when Apple released a way to make apps on an iPad. I use mine a lot, but was missing the ability to make stuff.<p>When Playgrounds 4 came out, I set myself a goal to produce an app A to Z entirely on an iPad. The code, all assets, scripts, icons, everything.<p>All in all, it took me about 2 months of evening hacking to get it to the app store. The app is written in SwiftUI, and additionally, I used iSh to write some scripts (bash and python) to manipulate the word lists.<p>The word lists were fairly tricky. To get started, I used some open-source Hunspell dictionaries I found online. Then I did some postprocessing:<p><pre><code> - extract the lemma form of each word (for some languages the game would be impossible without this sanitization) - filter for the right length - cross-check against an online thesaurus if the word really exists - remove (somewhat arbitrary) some weird words that wouldn&#x27;t be fun to guess </code></pre> Getting the lemma form was fairly slow on iSh, so I did this step on a DigitalOcean droplet (though still through the iPad using iSh + SSH).<p>For the python scripts, I used a split-screen setup: on one side I used the Buffer code editor, and on the other I used iSh. I mounted the editor filesystem into iSh, so I could simply run &quot;python3 myscript.py&quot; whenever I made any changes.<p>When I started out, I had 0 ideas about SwiftUI. It&#x27;s pretty cool, but I made a lot of rookie mistakes. The worst one was using a lot of inefficient computed properties before I realized that they might be called literally hundreds of times per keypress.<p>What I missed the most was the ability to write tests. I ended up compromising, and writing UIs that performed a test, and then presented a green&#x2F;red message about the outcome. I had dedicated &quot;test views&quot; that I manually inspected in the previews pane. It helped me catch some regressions, but it wasn&#x27;t a great experience.<p>Some features were not possible (initially I wanted to have iCloud synchronization, and localization, but Playgrounds doesn&#x27;t support these).<p>And - interestingly - while you can submit the app to the app store through Playgrounds, you have no way of generating the required screenshots on the iPad. I ended up initially faking some screenshots using Procreate (enlarging them to the right proportions). Subsequently, I wrote a view that simulated different screen sizes and could save a screenshot directly to the camera roll. This made it easy to submit new versions, as well as find actual layout issues from different size devices. All on the iPad.<p>Overall, the experience was very interesting. It was limiting, the screen was small, there were lots of bugs in the tools, and the previews didn&#x27;t always act the same as the real deal... but it was also cool. I found the friction was very small to resume coding (i.e. if I&#x27;m in couch potato mode, my iPad is usually nearby, whereas my MacBook isn&#x27;t always).<p>I&#x27;m now working on a different app, and while it&#x27;s written mainly in Xcode now, I still use the iPad to prototype views&#x2F;interactions when I can.<p>You can check it out on GitHub, it&#x27;s open source. The main branch is migrated to Xcode, but I kept a branch, which contains the app as it was developed on the iPad.
评论 #31620990 未加载