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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Swift gems for creating reliable, concurrent OS X desktop apps

46 点作者 misterdata将近 10 年前

4 条评论

Sidnicious将近 10 年前
Shameless plug for my tiny implementation of Promise (similar to the Future type mentioned in the article)[1].<p>I&#x27;ve used it in a few projects, and it makes dealing with async things feel surprisingly natural:<p><pre><code> getLocation() .then { apiRequest(params, location: $0) } .then { json -&gt; () in for result in json[&quot;results&quot;] { display(result) } } .catch { showError($0) } </code></pre> It&#x27;s also easy trivial to adapt existing callback-based[2] and delegate-based[3] APIs to promises.<p>[1]: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;Sidnicious&#x2F;93d2a8db1266e2fd239c" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;Sidnicious&#x2F;93d2a8db1266e2fd239c</a><p>[2]: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;Sidnicious&#x2F;69df2c483aadc08bda4f" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;Sidnicious&#x2F;69df2c483aadc08bda4f</a><p>[3]: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;Sidnicious&#x2F;99b099d9b6f2ecb9e383" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;Sidnicious&#x2F;99b099d9b6f2ecb9e383</a>
__bb将近 10 年前
The Failable type in the article looks like this Result project on GitHub [1]. It makes for interesting related reading.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;antitypical&#x2F;Result" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;antitypical&#x2F;Result</a>
评论 #9679593 未加载
SeoxyS将近 10 年前
&gt; LOGGING FROM DIFFERENT BACKGROUND THREADS AT ONCE<p>Or, you could just make a logging serial queue that you send all log messages to; that way there&#x27;s no risk of activity on the main thread slowing down your logging. In (Obj-)C:<p><pre><code> static queue_t queue; void log (NSString *message) { static dispatch_once_t onceToken; dispatch_once(&amp;onceToken, ^{ queue = dispatch_queue_create(&quot;logging&quot;, DISPATCH_QUEUE_SERIAL); }); dispatch_async(queue, ^{ NSLog(message); }); }</code></pre>
评论 #9715903 未加载
empyrical将近 10 年前
I seem to be getting an invalid certificate warning on this site, is this happening for anyone else?
评论 #9678784 未加载