{"id":20716361,"url":"https://github.com/tomortec/simplemagnifyingview","last_synced_at":"2025-04-23T13:21:26.401Z","repository":{"id":62457610,"uuid":"486458325","full_name":"Tomortec/SimpleMagnifyingView","owner":"Tomortec","description":"SimpleMagnifyingView can be used as a magnifier as the one iOS providing 🔍. SwiftUI supported!","archived":false,"fork":false,"pushed_at":"2022-05-04T15:26:56.000Z","size":1860,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-21T23:20:43.688Z","etag":null,"topics":["ios","magnifier","swift","swiftui","tomortec","ui"],"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/Tomortec.png","metadata":{"files":{"readme":"README-zh.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":"2022-04-28T05:29:29.000Z","updated_at":"2024-07-08T12:07:12.000Z","dependencies_parsed_at":"2022-11-02T00:31:33.696Z","dependency_job_id":null,"html_url":"https://github.com/Tomortec/SimpleMagnifyingView","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tomortec%2FSimpleMagnifyingView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tomortec%2FSimpleMagnifyingView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tomortec%2FSimpleMagnifyingView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tomortec%2FSimpleMagnifyingView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tomortec","download_url":"https://codeload.github.com/Tomortec/SimpleMagnifyingView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250439371,"owners_count":21430839,"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":["ios","magnifier","swift","swiftui","tomortec","ui"],"created_at":"2024-11-17T03:05:36.124Z","updated_at":"2025-04-23T13:21:26.382Z","avatar_url":"https://github.com/Tomortec.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleMagnifyingView\n\n\u003cimg src=\"./screenshot.png\" alt=\"Banner\" width=\"400\"\u003e\n\n`SimpleMagnifyingView` 是用 SwiftUI 写的放大镜 🔍\n\n\u003cp float=\"left\"\u003e\n    \u003cimg src=\"./demo.gif\" alt=\"Demo\" width=\"200\"\u003e \n    \u003cimg src=\"./demo-1.gif\" alt=\"Demo1\" width=\"200\"\u003e\n\u003c/p\u003e\n\n## 原理\n\n\u003cimg src=\"./how-it-works.png\" alt=\"How It Works\" width=\"400\"\u003e\n\n## 小示例\n\n``` Swift\nMagnifierView(isMagnifying: $isMagnifying, scale: .constant(1.8)) {\n    Text(\"Hello world\")\n        .foregroundColor(.white)\n        .frame(maxWidth: .infinity, maxHeight: .infinity)\n        .background(.cyan)\n}\n.outlineColor(.white)\n.closeButtonColor(.white)\n```\n\n克隆本仓库，在 `Example` 文件夹执行 `pod install` 后在 `Xcode` 运行示例项目来查看 demo\n\n## 接口\n\n### 初始化\n``` swift\ninit(\n    isMagnifying: Binding\u003cBool\u003e,    // 控制可见性\n    scale: Binding\u003cCGFloat\u003e = .constant(2.0),\n    glassShape: AnyShape = AnyShape(RoundedRectangle(cornerRadius: 12.0)),\n    @ViewBuilder _ content: () -\u003e Content\n)\n```\n\n### 有关放大镜的方法\n``` swift\n// 调整放大镜的尺寸\nfunc magnifyingGlassSize(_ size: CGSize)\n\n// 设置放大镜的形状\nfunc magnifyingGlassShape(_ shape: AnyShape)\n\n// 设置把柄的宽度比例（相对于放大镜的宽度）\nfunc handleWidthRatio(_ ratio: CGFloat)\n\n// 设置把柄的高度\nfunc handleHeight(_ height: CGFloat)\n\n// 设置放大镜的边框颜色\nfunc outlineColor(_ color: Color)\n\n// 设置放大镜的边框宽度\nfunc outlineWidth(_ width: CGFloat)\n\n// 是否允许在放大镜内交互\nfunc enableHitInMagnifyingGlass(_ enabled: Bool)\n```\n\n### 有关 mask 的方法\n``` swift\n// 设置 mask 的背景颜色\nfunc maskBackgroundColor(_ color: Color)\n\n// 设置关闭按钮的尺寸\nfunc closeButtonSize(_ size: CGSize)\n\n// 设置关闭按钮的颜色\nfunc closeButtonColor(_ color: Color)\n\n// 是否显示关闭按钮\nfunc enableCloseButton(_ enabled: Bool)\n```\n\n执行 Xcode 的 `Product \u003e Build Documentation` 并前往文档中心来查看 `SimpleMagnifyingView` 的更多接口细节\n\n## Swift 版本\n\nSwift \u003e= 5.0\n\n## 安装方法\n\n`SimpleMagnifyingView` 已在 [CocoaPods](https://cocoapods.org)发布。添加下列命令到你的 `Podfile` 来安装 `SimpleMagnifyingView`:\n\n```ruby\npod 'SimpleMagnifyingView'\n\n# 注意：如果您的 pod 没找到 `SimpleMagnifyingView`, 请使用下面的命令重试\n# pod `SimpleMagnifyingView`, :git =\u003e 'https://github.com/Tomortec/SimpleMagnifyingView.git'\n```\n\n## 作者\n\nTomortec, everything@tomortec.com\n\n## License\n\nSimpleMagnifyingView is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomortec%2Fsimplemagnifyingview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomortec%2Fsimplemagnifyingview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomortec%2Fsimplemagnifyingview/lists"}