建立私有软件的 apt 仓库
Mar 24, 2022
使用私有软件源可以很方便的安装自己开发或者编译的软件。 第三方软件源的存放在 /etc/apt/sources.list.d 目录: 创建一个软件源文件: /etc/apt/sources.list.d/swift-toolchain.list 软件源文件的内容如下: deb http://127.0.0.1/repo swift-toolchain main 以上几…
ssh 客户端通过代理连接服务器
Mar 22, 2022
ssh 客户端的代理功能需要通过 nc 转发来实现。 方法一:编辑 ~/.ssh/config ,添加以下内容: Host * ProxyCommand nc -X 5 -x 127.0.0.1:7890 %h %p 方法二:在命令中使用参数指定代理: ssh -o "ProxyCommand nc -X 5 -x 127.0.0.1:7890…
Swift 5 静态编译
Nov 17, 2021
Swift 是支持静态链接的,因为它是跨平台的语言。参考这里:Static linking on Linux 静态链接的好处就是不需要带 Swift 的一堆 Runtime 库,在 build 的时候增加 -static-stdlib 就可以了。 但是…
SwiftUI 入门指南
Sep 29, 2021
Introducing SwiftUI SwiftUI is a modern way to declare user interfaces for any Apple platform. Create beautiful, dynamic apps faster than ever before. SwiftUI Essentials Learn how to use SwiftUI to compose rich views out of simple ones, set up data flow, and build the navigation while watching it unfold in Xcode’s preview. Creating and Combining Views Create a new Xcode project that uses…
使用命令行工具测试 APNs
Sep 29, 2021
APNs 全称是 Apple Push Notification service (苹果推送通知服务)。 早期的 APNs 是使用证书的方式,缺点是有时效性,需要定期更换。 到了 iOS10 时期,苹果推出了新的认证方式:密钥标识符…
port 安装支持 HTTP/2 的 curl
Sep 29, 2021
macports 默认情况下安装 curl: sudo port install curl 以上命令安装的 curl 是不支持 HTTP/2 协议的。 如果需要支持 HTTP/2 ,需要添加变量 +http2,完整的安装命令: sudo port install curl +http2 参考…
iOS 15 开启更快的 ProMotion 刷新率
Sep 28, 2021
iPhone 13 Pro 系列支持最高 120Hz 的动态刷新率,App 需要主动适配才能使用动态刷新率。 在 Info.plist 里加上: <key>CADisableMinimumFrameDurationOnPhone</key><true/> 参考资料 Optimizing ProMotion Refresh Rates for iPhone 13 Pro and iPad Pro
编译 wget2 支持 HTTP/2
Sep 27, 2021
wget2 发布了,相对于 wget ,下载速度更快而且支持 HTTP/2 的特性。 macports 还没有预编译好的版本,想体验 wget2 只能自己编译了。 下载源码: wget2-2.0.0.tar.gz 解压缩: tar xvzf ./wget2-2.0.0.tar.gz 我使用的包管理工…
Swift:了解一下 defer
May 23, 2021
关于 defer 的几条说明: defer 会在退出其作用域的时候执行。 同一个作用域内可以定义多个 defer。 defer 不要定义在作用域的末尾(因为没有必要)。 一个例子解释…
clang 跨平台编译 iOS/macOS arm64/x86_64
May 19, 2021
Target 不同的目标平台对应不同的 -target $triple 参数: iOS 平台: armv7:-target arm64-apple-darwin arm64:-target armv7-apple-darwin macOS 平台: i386:-target i386-apple-macos x86…