{"id":32313595,"url":"https://github.com/ryukiesama/swifty","last_synced_at":"2025-10-23T10:04:10.879Z","repository":{"id":39165699,"uuid":"208560358","full_name":"RyukieSama/Swifty","owner":"RyukieSama","description":"Make swift code swifty","archived":false,"fork":false,"pushed_at":"2025-10-11T09:35:12.000Z","size":3247,"stargazers_count":297,"open_issues_count":8,"forks_count":57,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-21T09:33:39.611Z","etag":null,"topics":["extension","ios","protocol","safety","screenshield","screenshot","swift","tool"],"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/RyukieSama.png","metadata":{"files":{"readme":"README-EN.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}},"created_at":"2019-09-15T07:52:49.000Z","updated_at":"2025-10-20T02:36:25.000Z","dependencies_parsed_at":"2024-04-15T09:05:20.314Z","dependency_job_id":null,"html_url":"https://github.com/RyukieSama/Swifty","commit_stats":{"total_commits":73,"total_committers":2,"mean_commits":36.5,"dds":"0.013698630136986356","last_synced_commit":"0be9df78f25f7c350f90748a6b2de100186ee708"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/RyukieSama/Swifty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyukieSama%2FSwifty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyukieSama%2FSwifty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyukieSama%2FSwifty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyukieSama%2FSwifty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RyukieSama","download_url":"https://codeload.github.com/RyukieSama/Swifty/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyukieSama%2FSwifty/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280598972,"owners_count":26357982,"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","status":"online","status_checked_at":"2025-10-23T02:00:06.710Z","response_time":142,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["extension","ios","protocol","safety","screenshield","screenshot","swift","tool"],"created_at":"2025-10-23T10:04:10.574Z","updated_at":"2025-10-23T10:04:10.874Z","avatar_url":"https://github.com/RyukieSama.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swifty - Make swift code swifty\n\n[中文](README.md) | English\n\n[![CI Status](https://img.shields.io/travis/RyukieSama/RyukieSwifty.svg?style=flat)](https://travis-ci.org/RyukieSama/RyukieSwifty)\n[![Version](https://img.shields.io/cocoapods/v/RyukieSwifty.svg?style=flat)](https://cocoapods.org/pods/RyukieSwifty)\n[![License](https://img.shields.io/cocoapods/l/RyukieSwifty.svg?style=flat)](https://cocoapods.org/pods/RyukieSwifty)\n[![Platform](https://img.shields.io/cocoapods/p/Swifty.svg?style=flat)](https://cocoapods.org/pods/RyukieSwifty)\n\n## 1. Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## 2. All install\n\n```ruby\npod 'RyukieSwifty'\n```\n\n## 3. Subspec install\n\n### 3.1 UIKit Extension\n\n```ruby\npod 'RyukieSwifty/UIKit'\n```\n\n### 3.2 CloudKit Extension\n\n```ruby\npod 'RyukieSwifty/CloudKit'\n```\n\n### 3.3 Foundation Extension\n\n```ruby\npod 'RyukieSwifty/Foundation'\n```\n\n### 3.4 DeviceOrientation Extension\n\n\n```ruby\npod 'RyukieSwifty/FullScreen'\n```\n\n```swift\nimport UIKit\nimport RyukieSwifty\n\nclass FullScreenViewController: UIViewController {\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        setupUI()\n    }\n    \n    // MARK: - Life\n    override func viewWillDisappear(_ animated: Bool) {\n        super.viewWillDisappear(animated)\n        swifty.exitFullScreen()\n    }\n    \n    override func viewWillAppear(_ animated: Bool) {\n        super.viewWillAppear(animated)\n        swifty.needFullScreen()\n    }\n    \n    override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {\n        super.viewWillTransition(to: size, with: coordinator)\n        if size.width \u003e size.height {\n            switchButton.isSelected = true\n        } else {\n            switchButton.isSelected = false\n        }\n    }\n    // MARK: - Function-Public\n    \n    // MARK: - Function-Private\n    \n    // MARK: UI\n    private func setupUI() {\n        view.backgroundColor = .white\n        \n        switchButton\n            .added(to: view)\n            .layout { make in\n                make?.center.equalToSuperview()\n            }\n    }\n    \n    // MARK: Buiness\n    \n    // MARK: Action\n    @objc\n    private func switchAction() {\n        switchButton.isSelected ? swifty.exitFullScreen() : swifty.enterFullScreen()\n    }\n    \n    // MARK: Request\n    \n    // MARK: - VarLet-Public\n    \n    // MARK: - VarLet-Private\n    private lazy var switchButton: UIButton = {\n        return UIButton()\n            .config {\n                $0.setTitleColor(.black, for: .normal)\n                $0.setTitle(\"切换为横屏\", for: .normal)\n                $0.setTitle(\"切换为竖屏\", for: .selected)\n                $0.addTarget(self, action: #selector(switchAction), for: .touchUpInside)\n            }\n    }()\n}\n\nextension AppDelegate {\n    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -\u003e UIInterfaceOrientationMask {\n        return application.swifty.supportedInterfaceOrientations\n    }\n}\n```\n\n### 3.5 Router Protocol\n\n```ruby\npod 'RyukieSwifty/Router'\n```\n\n### 3.6 Service Protocol - MoyaStyleProtocol\n\nMake network request code more `Moya` style more `Swifty`. Didn`t depend on any framework, easy to change and extend.\n\n```ruby\npod 'RyukieSwifty/SwiftyServiceProtocol'\n```\n\n### 3.7 ScreenShield (\u003e= iOS13) - 截屏防护\n\nLight way to protect content in view form screenshort and record. Add contents you want to protect in `ScreenShieldView`, they will be hide during screenshort and record.\n\n![ScreenShield](ScreenShield.gif)\n\n```ruby\npod 'RyukieSwifty/ScreenShield'\n```\n\nSwift - Demo: \n\n```Swift\nimport UIKit\nimport RyukieSwifty\n\nclass ViewController: UIViewController {\n    override func loadView() {\n        view = ScreenShieldView.create()\n    }\n    ...\n}\n```\n\nOC - Demo:\n\n```C++\n#import \"OCScreenShieldViewController.h\"\n@import RyukieSwifty;\n\n@interface OCScreenShieldViewController ()\n\n@end\n\n@implementation OCScreenShieldViewController\n\n- (void)loadView {\n    self.view = [ScreenShieldView createWithFrame:UIScreen.mainScreen.bounds];\n}\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    \n    UIView *cubeView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];\n    cubeView.backgroundColor = [UIColor redColor];\n    [self.view addSubview:cubeView];\n    \n    self.view.backgroundColor = [UIColor grayColor];\n}\n\n@end\n```\n\n## 4. Author\n\nRyukieSama, ryukie.sama@gmail.com\n\n## License\n\nSwifty is available under the MIT license. See the LICENSE file for more info.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryukiesama%2Fswifty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryukiesama%2Fswifty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryukiesama%2Fswifty/lists"}