{"id":17281318,"url":"https://github.com/xaoxuu/inspire","last_synced_at":"2025-04-14T09:43:15.352Z","repository":{"id":38325903,"uuid":"177695553","full_name":"xaoxuu/Inspire","owner":"xaoxuu","description":"主题式Swift开发工具包，包含布局、颜色、字体等。","archived":false,"fork":false,"pushed_at":"2022-10-10T07:55:41.000Z","size":985,"stargazers_count":15,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-23T18:14:09.025Z","etag":null,"topics":["cocoapods","framework","podfile","pods","swift"],"latest_commit_sha":null,"homepage":"https://xaoxuu.com/wiki/inspire","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xaoxuu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-26T01:53:10.000Z","updated_at":"2023-08-18T11:19:43.000Z","dependencies_parsed_at":"2022-08-25T03:01:41.137Z","dependency_job_id":null,"html_url":"https://github.com/xaoxuu/Inspire","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaoxuu%2FInspire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaoxuu%2FInspire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaoxuu%2FInspire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaoxuu%2FInspire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xaoxuu","download_url":"https://codeload.github.com/xaoxuu/Inspire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248856251,"owners_count":21172723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cocoapods","framework","podfile","pods","swift"],"created_at":"2024-10-15T09:45:31.727Z","updated_at":"2025-04-14T09:43:15.330Z","avatar_url":"https://github.com/xaoxuu.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Inspire\n\n基于主题的Swift开发基础工具包\n\n包含颜色、字体、布局等，可配置可缓存\n\n\u003c!-- more --\u003e\n\n## 特性\n\n### 可缓存的\n\n- App 的样式参数（颜色、字体、布局）存储于 json 文件中。\n\n### 可配置的\n\n- 可由用户修改主题参数并保存或者分享。\n\n### 提供便利\n\n- 便捷的方式获取屏幕布局参数、如各边安全区域尺寸，便于机型适配。\n\n\n## 开始使用\n\n### 使用 CocoaPods\n\n```ruby 在 Podfile 中添加：\npod 'Inspire'\n```\n\n```sh 然后执行：\npod install\n```\n\n### 使用 Package.swift \n\n在 Package.swift 中声明依赖项：\n\n```swift\n.package(url: \"https://github.com/xaoxuu/Inspire.git\", from: \"1.1.0\"),\n```\n\n\n## 用法示例\n\n\n\n### 颜色\n\n```swift\nview.backgroundColor = .background\nview.tintColor = .accent\n```\n\n### 字体\n\n```swift\nlet lb = UILabel()\nlb.font = .regular(15)\nlb.font = .bold(20, for: .title)\nlb.font = .regular(14, for: .code)\n```\n\n### 边距\n\n\n```swift\nlet topMargin = layout.topBarHeight(for: self)\nlet bottomMargin = layout.bottomBarHeight(for: self)\nlet safeArea = layout.safeAreaInsets(for: self)\nlet safeArea2 = Inspire.shared.screen.safeAreaInsets\n```\n\n```swift\nlet layout = Inspire.shared.layout\nview.frame.size.height = layout.rowHeight\nview.layer.cornerRadius = layout.cornerRadius.large\n```\n\n### 缓存\n\n```swift\n// 保存\nInspire.shared.cache()\nInspire.shared.cache(named: \"myTheme\")\n// 读取\nlet ipr = Inspire.init(\"myTheme\")\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaoxuu%2Finspire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxaoxuu%2Finspire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaoxuu%2Finspire/lists"}