今天继续来一篇水文,关于 Alamofire 和 RxSwift 两个组件中扩展后缀 .af 以及 .rx 是怎么实现的。相信用过的 ( ̄ω ̄( ̄ω ̄〃 ( ̄ω ̄〃)ゝ 都看过了。我这里权当自己的记录流水账了。
什么是消息派发? # 消息派发,英文名称 Method Dispatch,是指程序在运行过程中调用某个方法的时候决议使用哪个具体指令的过程。消息派发的行为在我们代码中时时刻刻的在发生。了解消息派发的机制对于我们日常写出相对高效的代码也是有利的,日常 Coding 的时候遇到一些派发相关的问题,也能做到心里有数。
Protocol 作为 Swift 生态的最重要的组成部分(没有之一),其搭建起了整个语言生态的各个组成部分。
当我们从网络上下载某个 mac app 之后,一般都会默认在 Downloads 目录里,但是某一些 App 是需要放置到 Application 目录才行,最常见的就是自更新功能是受到当前所处目录的限制的,这时候很多下载到本地的 .app 文件打开之后都会弹出提示框,让用户选择是否移动到 Applications 目录,LetsMove 就是大部分 mac app 参考或者集成的开源库,封装了这套逻辑。
关于 XPC # 因为最近在做的工作涉及到这一块,就大致的记录一下,针对 XPC 技术也做个总结。
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.
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.
这两天在 Twitter 上看到一道题目,主要是考察 overload 和 type(of:) 的知识点,本文仅做记录,关于 MetaType 会单独写一篇文章来总结。
Library 和 Framework 的概念大家应该脑海里都有一些,本文旨在讲述下基本概念,没有对每个字节都了如指掌。关于基本的编译过程在 Build Process 一文中也大概讲述了一些。
编程语言的处理过程大致会有五个阶段,其每个阶段均有对应的工具:
预处理器 Preprocessor 编译器 Compiler 汇编器 Assembler 链接器 Linker 加载器 Loader 我们以一个简单的源文件,来看看具体这几个步骤都做了哪些事情。