创建单个 swift 可执行文件

xcrun/swift 命令工具

  1. 第一种
    vi test.swift
    #!/usr/bin/env xcrun swift
    print(“hello”)

    $ chmod 755 test.swift
    $ ./test.swift

  2. 第二种
    $ cat «EOF > script
    #!/usr/bin/swift
    print(“Hi!”)
    EOF
    $ chmod u+x script
    $ ./script
    Hi!

swift-sh 支持库依赖

  1. 安装命令
    brew install swift-sh
  2. 使用
    $ cat «EOF > script
    #!/usr/bin/swift sh
    import PromiseKit // @mxcl ~> 6.5
    print(Promise.value(“Hi!”))
    EOF
    $ chmod u+x script
    $ ./script
    Promise(“Hi!”)
  3. 升级
    $ git clone https://github.com/mxcl/swift-sh.git
    $ cd swift-sh
    $ swift build
    把编译后的可执行文件 swift-sh,拷贝到 dotfiles/swift-sh/bin/swift-sh

/**
^^Import local files https://github.com/mxcl/swift-sh/issues/17
^^ import Foobar // ./test2.swift
^^仅支持导入由 SPM 管理的项目(Package.swift)
^^暂时不支持 swift 文件导入方式,不能像 ruby 一样加载另一个 rb 文件
*/

SPM 管理库依赖和发布私库工具

  • 问题 1:如何支持 iOS 项目到目前为止,它仅支持命令行工具和服务器端 Swift 应用程序
    Swift Package Manager for iOS – Guide & New Features | TSH.io
    无论您是使用第三方依赖关系,开发自己的内部框架,还是只想提取应用程序代码的一部分以使其模块化和有序(或同时包含所有内容),Swift Package Manager 都将非常有用。随着 Xcode 11 的发布,它将成为 Apple IDE 的重要组成部分。现在,SPM 软件包可与所有 Apple 平台一起使用,包括 iOS 系统(到目前为止,它仅支持命令行工具和服务器端 Swift 应用程序)。如果您尚未使用 SPM,现在是尝试一下的最佳时机!

Adopting Swift Packages in Xcode - WWDC 2019 - Videos - Apple Developer
Creating Swift Packages - WWDC 2019 - Videos - Apple Developer

Cocoapods 使用

集成命令

配置 spec 索引文件

设置本地依赖库的方式:
库存放地址问题:不支持库外路径例如:~/等,只能在 spec 目录中存放库。在提交到私有仓库的时候需要加上–use-libraries

plantuml 使用

下载历史 jar包plantuml.jar历史版本路径

命令行 uml 预览

  1. 您也可以使用下面的命令行运行 PlantUML:
    java -jar plantuml.jar file1 file2 file3
    这将在 file1, file2 和 file3 中寻找 @startXYZ。 对于每个图表, 都将创建一个 .png 文件。
  2. 对于处理整个文件夹, 您可以使用:
    java -jar plantuml.jar “c:/directory1” “c:/directory2”
    此命令将寻找 @startXYZ 和 @endXYZ 位于 c:/directory1 和 c:/directory2 目录中的 .c, .h, .cpp, .txt, .pu, .tex, .html, .htm 或.java 文件。
  3. 辅助方法在 dotfiles/doom/aliases.zsh 中添加别名。
    alias plantuml=‘java -jar ~/.emacs.d/.local/etc/plantuml.jar’

M-x: plantuml-download-jar

  • State “DONE” from “TODO” [2020-04-10 Fri 17:31]

当缺少 jar 时,使用命令该命令安装 jar

doom 使用

编辑命令

撤销:undo (u)
重做:C + r :undo-fu-only-redo
只读:spc t r
浏览编辑历史树:M-x: undo-tree-visualize(C-x u)

安装和配置

dotfile 中的配置

hugo 项目中管理 doom 版本

doom 工具的基本命令(install/refresh/upgrade)使用

  • State “DONE” from “TODO” [2020-03-24 二 15:46]

`控制工作`:任务任用

APPlink 的使用

增加 web 端打开短视频 APP
参考教程:http://docs.getui.com/getui/mobile/ios/applink/

  • 协调李军峰在分享组件中添加 SchemeUrl 配置字段协商之后,使用分享组件添加 schemeUrl,目的为了便于其他 APP 快速支持第三方打开 APP
  • 配置短视频支持第三方打开
    1. 在短视频 APP 中,添加分享组件,设置 schemeUrl 值:/shortVideoCode
    2. 打包,查看配置结果正式环境:https://jhbac.iuoooo.com/apple-app-site-association
      测试环境:http://testbac.iuoooo.com/apple-app-site-association
    3. 在 Xcode 配置 APP 的 Associated Domains
      测试环境:applinks:testbac.iuoooo.com
      正式环境:applinks:jhbac-ui.iuoooo.com
    4. 验证第三方打开测试环境:暂不支持测试,需要把 Associated Domains 的测试 links 同步到主工程才行。暂时不考虑测试地址:https://testbac.iuoooo.com/shortVideoCode
      正式环境:平台下载包安装到手机之后,正式地址:https://jhbac.iuoooo.com/shortVideoCode
      使用 Safari 访问下面路径,既可打开短视频 APP
      1. 当 APP 已经安装自动启动 applink 所指向的 APP,甚至可以定位到 app 的具体页面。
      2. 当没安装 APP
        Safari 会自动打开 applink 指向的网页。需要 web 服务器在改地址下提供一个有效的网页(自动跳转到 AppStore 或者 web 端设计一套下载引导页)

XVim 插件

  • Xcode 重签名证书:钥匙串访问—证书助理:创建证书 — 名称:XcodeResign 类型:代码签名签名:sudo codesign -f -s XcodeResign(证书名) /Applications/Xcode.app

签名问题
/Applications/Xcode.app: replacing existing signature
/Applications/Xcode.app: resource fork, Finder information, or similar detritus not allowed
解决命令:
sudo xattr -cr /Applications/Xcode.app

Xcode 快捷键使用

  • State “DONE” from “TODO” [2020-05-16 六 20:45]

  • State “TODO” from “DONE” [2020-05-16 六 20:45]

  • State “DONE” from “CANCEL” [2020-03-07 六 10:21]

  • 新建 Tab 页: command + t

    1. 关闭 tab 页: command + w
    2. 左右切换 tab 页: shift + command + [ 或 ]
    3. 预览所有 tab 页: shift + command + \
    4. 选中激活 tab 页: command + .
  • editer 编辑器

总结集成工具使用文档

DONE jazzy工具使用实现基本的文档的生成,并同步到hugo目录中

支持oc/swift文档

  1. swift文档

  2. oc 文档

  3. .jazzy.yaml配置文件使用

    1
    2
    3
    4
    5
    6
    7
    8
    
    author: Alamofire Software Foundation
    author_url: http://alamofire.org/
    github_url: https://github.com/Alamofire/Alamofire
    root_url: https://alamofire.github.io/Alamofire/
    module: Alamofire
    output: docs
    theme: fullwidth
    xcodebuild_arguments: [-workspace, 'Alamofire.xcworkspace', -scheme, 'Alamofire iOS']

    使用test.sh