{"id":26326226,"url":"https://github.com/kk-vv/iosarchitecture","last_synced_at":"2026-05-21T04:03:04.775Z","repository":{"id":79747772,"uuid":"201408057","full_name":"kk-vv/iOSArchitecture","owner":"kk-vv","description":"iOS Common Architecture Template","archived":false,"fork":false,"pushed_at":"2019-08-28T02:45:02.000Z","size":14633,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T19:38:19.550Z","etag":null,"topics":["router","sourcery","stencil","swiftgen","swiftlint","urlnavigator","xcconfig","yaml"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kk-vv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-09T06:44:48.000Z","updated_at":"2024-12-30T11:52:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"58f92a2c-9e9f-47b9-abbd-9601750fbfa1","html_url":"https://github.com/kk-vv/iOSArchitecture","commit_stats":null,"previous_names":["kk-vv/iosarchitecture"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kk-vv/iOSArchitecture","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kk-vv%2FiOSArchitecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kk-vv%2FiOSArchitecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kk-vv%2FiOSArchitecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kk-vv%2FiOSArchitecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kk-vv","download_url":"https://codeload.github.com/kk-vv/iOSArchitecture/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kk-vv%2FiOSArchitecture/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33288126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T02:57:32.698Z","status":"ssl_error","status_checked_at":"2026-05-21T02:57:31.990Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["router","sourcery","stencil","swiftgen","swiftlint","urlnavigator","xcconfig","yaml"],"created_at":"2025-03-15T19:35:58.274Z","updated_at":"2026-05-21T04:03:04.769Z","avatar_url":"https://github.com/kk-vv.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"### iOS Swift Common Architecture\n\n\u003emeta-programming(元编程-code write code)\n\n```\n可以从两个层面上来理解：\n\n在运行时通过反射之类的技术来动态修改程序自身的结构。比如说我们都非常熟悉的Objective-C Runtime。\n\n通过DSL来生成特定的代码，这通常发生在编译期预处理阶段。\n```\n\n#### Sourcery\n\u003esourcery read config from .sourcery.yml \n\n- pod 'Sourcery'\n- Shell Config (Under Check Pods Manifest.lock)\n\n```\nif [ \"$CONFIGURATION\" == \"Debug\" ] ; then\n$PODS_ROOT/Sourcery/bin/sourcery\nfi\n```\n\n- Config File\n\n```\n- sources: source file\n- templates: stencil file\n- output: generated file\n```\n\n- 命令行实现\n\n```\nsourcery \\\n   --sources ./YourProject \\\n   --templates ./YourTemplates \\\n   --output ./YourProject/AutoGenerated.swift\n```\n\n- yml配置文件实现\n\n```\n.sourcery.yml\n\nsources:\n  - SourceryT/Class\ntemplates:\n  - Templates/AutoEquatable.stencil\n  #- Templates/Colors.stencil\n  #- Templates/ModelConvert.stencil\n  #- Templates/Router.stencil\n  #...\noutput:\n  Generated\n\n```\n\n```\nAutoEquatable.stencil\n\n{# AutoEquatable Generator Template #}\n{{\"//autoequatable\"|uppercase}}\n{% for type in types.implementing.AutoEquatable %}\n//MARK: - {{type.name}}\nextension {{type.name}}: Equatable {\n    static func == (lhs:{{type.name}}, rhs: {{type.name}}) -\u003e Bool {\n        {% for variable in type.storedVariables %}\n        guard lhs.{{variable.name}} == rhs.{{variable.name}} else {\n            return false\n        }\n        {% endfor %}\n        return true\n    }\n}\n{% endfor %}\n\n```\n\n##### Sourcery Annotation\n\n\u003e Sourcery自定义 规则\n\n- [Documents](https://littlebitesofcocoa.com/295-building-an-api-client-with-sourcery-key-value-annotations)\n\n```\ne.g.\n/// sourcery: key = value\n/// sourcery: anotherKey = someOtherValue\nalso\n/// sourcery: key = value, anotherKey = someOtherValue\ncontain some basic types\n\n/// sourcery: maxSpeed = 1500, hasHyperdrive = true\n/// sourcery: codename = \"blacksaber\"\n\n```\n\n- Exp\n\n```\nenum SpaceshipsAPI {\n    /// sourcery: method = \"GET\", path = \"/spaceships\"\n    /// sourcery: timeout = 5\n    case ships\n    ...\n}\n\n//SpaceshipsAPI+Properties.stencil\nextension SpaceshipsAPI {\n  public var path: String? {\n    switch self {\n      {% for c in type.SpaceshipsAPI.cases %}\n      {% if c.annotations.path %}\n      case .{{ c.name }}: return \"{{c.annotations.path}}\"\n      {% endif %}\n    {% endfor %}\n    default: return nil\n    }\n  }\n\n  // ... etc\n}\n```\n\n\n##### Stencil\n\n```\nStencil是一门用Swift实现的专门为Swift设计的模板语言\n```\n\n- [GitHub](https://github.com/stencilproject/Stencil)\n\n- {{ ... }}\n\u003e变量语法，将中间的部分作为变量（或变量的表达式）来解析，解析后的值会作为结果插入到模板中的相应位置上。\n\n- {% ... %}\n\u003e标签语法（Tag），标签用来表示一些具有特殊功能的语法，比如用来实现判断的if和循环的for。\n\n- {# ... #}\n\u003e注释语法，不会出现在解析后的结果中\n\n\n\u003e除此之外还有一个名为Filter的概念，它的语法是这样的：{{ \"stencil\"|uppercase }}。符号|左边是输入的变量，右边就是一个Filter，这里输出了字符串的大写形式.\n\u003e[String Filter](https://github.com/SwiftGen/StencilSwiftKit/blob/master/Documentation/filters-strings.md)\n\n\n\n\n##### StencilSwiftKit\n\n- [Documentation](https://github.com/SwiftGen/StencilSwiftKit/tree/master/Documentation)\n\n##### Projects that use Stencil\n\n- [Soucery](https://github.com/krzysztofzablocki/Sourcery)\n- [SwiftGen](https://github.com/SwiftGen/SwiftGen)\n- [Weaver](https://github.com/scribd/Weaver)\n\n\n#### VSCode - Stencil/YAML 插件\n\n##### YAML\n\n\u003eYAML: YAML Ain't Markup Language\n\n- [ORG](https://yaml.org)\n- [1.2](https://yaml.org/spec/1.2/spec.html)\n\n##### YamlSwift\n\n\u003e 解析一串YAML文档( 或者JSON文档) 并返回一个表示该字符串的Yaml enum 值\n\n- [GitHub](https://github.com/behrang/YamlSwift)\n\n\n#### Apple/SwiftSyntax\n\n\u003eIt allows for Swift tools to parse, inspect, generate, and transform Swift source code.\n\n- [SwiftSyntax](https://github.com/apple/swift-syntax)\n\n#### SwiftGen/StencilSwiftKit\n\n- [Documents](https://github.com/SwiftGen/StencilSwiftKit)\n\n### Others\n\n- SwiftGen\n- SwiftLint\n- URLNavigator\n- XCConfig\n- SwiftMonkey(Paws) (Test)\n- DoraemonKit\n- SwifterSwift(more than 500 native Swift extensions)\n- MonkeyKing(Handle Open URL)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkk-vv%2Fiosarchitecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkk-vv%2Fiosarchitecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkk-vv%2Fiosarchitecture/lists"}