{"id":15038075,"url":"https://github.com/lixiang1994/autoinch","last_synced_at":"2025-04-08T00:40:01.297Z","repository":{"id":56902575,"uuid":"134392099","full_name":"lixiang1994/AutoInch","owner":"lixiang1994","description":"优雅的iPhone全尺寸/等比例精准适配工具","archived":false,"fork":false,"pushed_at":"2024-09-26T09:40:10.000Z","size":1177,"stargazers_count":471,"open_issues_count":7,"forks_count":44,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-08T00:39:44.408Z","etag":null,"topics":["adapter","auto","autolayout","inch","ios","ios-app","ios-demo","ios-swift","ios-ui","iphone","iphonex","iphonexsmax","layout","lee","nib","screen","storyboard","swift","swift4","xib"],"latest_commit_sha":null,"homepage":"","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/lixiang1994.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-22T09:28:56.000Z","updated_at":"2025-03-10T09:48:16.000Z","dependencies_parsed_at":"2024-06-18T18:12:57.155Z","dependency_job_id":"fb818ba8-d051-43a6-89ad-e90d421efcee","html_url":"https://github.com/lixiang1994/AutoInch","commit_stats":{"total_commits":115,"total_committers":1,"mean_commits":115.0,"dds":0.0,"last_synced_commit":"fd1a428efcecaa6a51b93a1666c8102ff2effef0"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lixiang1994%2FAutoInch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lixiang1994%2FAutoInch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lixiang1994%2FAutoInch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lixiang1994%2FAutoInch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lixiang1994","download_url":"https://codeload.github.com/lixiang1994/AutoInch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755560,"owners_count":20990620,"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":["adapter","auto","autolayout","inch","ios","ios-app","ios-demo","ios-swift","ios-ui","iphone","iphonex","iphonexsmax","layout","lee","nib","screen","storyboard","swift","swift4","xib"],"created_at":"2024-09-24T20:37:00.471Z","updated_at":"2025-04-08T00:40:01.177Z","avatar_url":"https://github.com/lixiang1994.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AutoInch - 优雅的iPhone等比例/全尺寸精准适配工具\n\n[![License](https://img.shields.io/cocoapods/l/AutoInch.svg)](LICENSE)\u0026nbsp;\n![Swift](https://img.shields.io/badge/Swift-5.2-orange.svg)\u0026nbsp;\n![Platform](https://img.shields.io/cocoapods/p/AutoInch.svg?style=flat)\u0026nbsp;\n[![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-4BC51D.svg?style=flat\")](https://swift.org/package-manager/)\u0026nbsp;\n[![Carthage](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\u0026nbsp;\n[![Cocoapods](https://img.shields.io/cocoapods/v/AutoInch.svg)](https://cocoapods.org)\n\n## [:cn:天朝子民](README_CN.md)\n\n## If you haven't used it, Please use [Rename -\u003e UIAdapter](https://github.com/lixiang1994/UIAdapter).\n\n## If you have used it and want to migrate together, Please check the [migration guide](https://github.com/lixiang1994/AutoInch/blob/master/RENAMEGUIDE.md)\n\n## Features\n\n- [x] Numerical type fast conversion\n- [x] Storyboard equal scale adaptation \n- [x] Xib equal scale adaptation \n- [x] Custom calculation processing\n- [x] Quick match for each screen size type\n\n\n## Installation\n\n**CocoaPods - Podfile**\n\n```ruby\npod 'AutoInch'\n```\n\n**Carthage - Cartfile**\n\n```ruby\ngithub \"lixiang1994/AutoInch\"\n```\n\n#### [Swift Package Manager for Apple platforms](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)\n\nSelect Xcode menu `File \u003e Swift Packages \u003e Add Package Dependency` and enter repository URL with GUI.  \n```\nRepository: https://github.com/lixiang1994/AutoInch\n```\n\n#### [Swift Package Manager](https://swift.org/package-manager/)\n\nAdd the following to the dependencies of your `Package.swift`:\n```swift\n.package(url: \"https://github.com/lixiang1994/AutoInch.git\", from: \"version\")\n```\n\n## Usage\n\nFirst make sure to import the framework:\n\n```swift\nimport AutoInch\n```\n\nHere are some usage examples. All devices are also available as simulators:\n\n\n### Auto\n\n\nAutoLayout (SnapKit): \n\n```swift\nprivate func setupLayout() {\n    cardView.snp.makeConstraints { (make) in\n\tmake.top.equalTo(16.auto())\n\tmake.left.right.equalToSuperview().inset(15.auto())\n\tmake.bottom.equalTo(-26.auto())\n    }\n\t\n    lineView.snp.makeConstraints { (make) in\n\tmake.left.right.equalToSuperview().inset(15.auto())\n\tmake.top.equalTo(titleLabel.snp.bottom)\n\tmake.height.equalTo(1)\n    }\n        \n    titleLabel.snp.makeConstraints { (make) in\n        make.top.equalToSuperview()\n        make.left.equalTo(15.auto())\n        make.height.equalTo(48.auto())\n    }\n        \n    stateLabel.snp.makeConstraints { (make) in\n        make.top.equalTo(lineView).offset(10.auto())\n        make.left.equalTo(15.auto())\n        make.height.equalTo(15.auto())\n    }\n}\n```\n\nProperty (Then):\n\n```swift\nprivate lazy var cardView = UIView().then {\n    $0.cornerRadius = 6.auto()\n    $0.backgroundColor = .white\n}\n\nprivate lazy var lineView = UIView().then {\n    $0.backgroundColor = .hex(\"000000\", alpha: 0.05)\n}\n\nprivate lazy var titleLabel = UILabel().then {\n    $0.textColor = .black\n    $0.font = .systemFont(ofSize: 20.auto(), weight: .medium)\n}\n\nprivate lazy var stateLabel = UILabel().then {\n    $0.textColor = .gray\n    $0.font = .systemFont(ofSize: 12.auto(), weight: .medium)\n}\n```\n\nStoryboard / Xib:\n\n![Constraint](Resources/Storyboard%20Constraint.png)\n![UILabel Font](Resources/Storyboard%20Label%20Font.png)\n\n### Screen\n\ne.g.\n\n```swift\n// default other screen numberOfLines = 0\n// 3.5 inches screen numberOfLines = 1\n// 4.0 inches screen numberOfLines = 2\nlabel.numberOfLines = 0.screen.inch(._3_5, is: 1).inch(._4_0, is: 2).value\n```\n\n\n```swift\n// default other screen numberOfLines = 0\n// width 320 screen numberOfLines = 1\n// width 375 screen numberOfLines = 2\nlabel.numberOfLines = 0.screen.width(equalTo: 320, is: 1).width(equalTo: 375, is: 2).value\n```\n\n\n```swift\nprint(\"this is \" + \"default\".screen\n    .width(equalTo: 375, is: \"width equal to 375\")\n    .width(lessThan: 414, is: \"width less than 414\")\n    .width(greaterThan: 414, is: \"width greater than 414\")\n    .height(equalTo: 700, is: \"height equal to 375\")\n    .height(lessThan: 844, is: \"height less than 844\")\n    .height(greaterThan: 844, is: \"height greater than 844\")\n    .inch(._4_7, is: \"4.7-inch\")\n    .inch(._5_8, is: \"5.8-inch\")\n    .inch(._6_5, is: \"6.5-inch\")\n    .level(.compact, is: \"screen (4:3)\")\n    .level(.regular, is: \"screen (16:9)\")\n    .level(.full, is: \"screen (19.5:9)\")\n    .value\n)\n```\n\n\n## Screenshot\n\n![TikTok 1](Resources/Storyboard%20TikTok%20Demo1.jpg)\n\n![TikTok 2](Resources/Storyboard%20TikTok%20Demo2.jpg)\n\n## Contributing\n\nIf you have the need for a specific feature that you want implemented or if you experienced a bug, please open an issue.\nIf you extended the functionality of AutoInch yourself and want others to use it too, please submit a pull request.\n\n\n## License\n\nAutoInch is under MIT license. See the [LICENSE](LICENSE) file for more info.\n\n\n\u003e### [相关文章 Inch](https://www.jianshu.com/p/d2c09cb65ef7)\n\u003e### [相关文章 Auto](https://www.jianshu.com/p/e0e12206e0c7)\n\u003e### [相关文章 Auto](https://www.jianshu.com/p/48c67d0c95b6)\n\n-----\n\n\u003e ## 欢迎入群交流\n![QQ](https://github.com/lixiang1994/Resources/blob/master/QQClub/QQClub.JPG)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flixiang1994%2Fautoinch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flixiang1994%2Fautoinch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flixiang1994%2Fautoinch/lists"}