当我们从网络上下载某个 mac app 之后,一般都会默认在 Downloads 目录里,但是某一些 App 是需要放置到 Application 目录才行,最常见的就是自更新功能是受到当前所处目录的限制的,这时候很多下载到本地的 .app 文件打开之后都会弹出提示框,让用户选择是否移动到 Applications 目录,LetsMove 就是大部分 mac app 参考或者集成的开源库,封装了这套逻辑。
LetsMove 中的几个点
XPC Services
关于 XPC
因为最近在做的工作涉及到这一块,就大致的记录一下,针对 XPC 技术也做个总结。
XPC 是 macOS 上一种进程间通信的技术统称,其使得我们可以将 Mac 应用的功能模块拆分成不同的多进程模式,关于进程之间的通信也被系统封装完整了,你只需要按照既定的模式做即可。其带来的最大的好处是
Codable && Tuple
During my learning of Swift, many interesting things I will find. Codable is one of them.
Today, I defined a model with a tuple type, then Xcode told me some error. Codes may like as below.

You may want Xcode automatically complete all the codable stuff. However, life is hard. Codes like these can even not be compiled. Xcode will tell you name cannot be synthesize the Person because of the FullName.
How to generate a NSViewController without a Nib?
In the last days, I created all the ViewControllers through the storyboard or the Nib (for views). Today, when I created a demo project without any Nib file, the ViewController did not show as I expected.
WTF, Can you believe that? I cannot even create a ViewController now.
There exist some differences between iOS and macOS.
iOS
In the previous development on the iOS platform, create a ViewController, specifically UIViewController instance, is dead simple as below.
一道 Swift Quiz
这两天在 Twitter 上看到一道题目,主要是考察 overload 和 type(of:) 的知识点,本文仅做记录,关于 MetaType 会单独写一篇文章来总结。
|
|
答案的分布说明,大家对这个输出结果还是有一定的疑惑🤔