{"id":17540486,"url":"https://github.com/fromkk/maskableview","last_synced_at":"2025-03-29T04:41:15.825Z","repository":{"id":146698095,"uuid":"77507020","full_name":"fromkk/MaskableView","owner":"fromkk","description":null,"archived":false,"fork":false,"pushed_at":"2016-12-28T13:37:16.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T14:27:42.482Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/fromkk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2016-12-28T05:57:03.000Z","updated_at":"2016-12-28T05:57:27.000Z","dependencies_parsed_at":"2023-04-03T11:33:23.022Z","dependency_job_id":null,"html_url":"https://github.com/fromkk/MaskableView","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"ad73909e488077b5c3724865f4578c4904798a21"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fromkk%2FMaskableView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fromkk%2FMaskableView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fromkk%2FMaskableView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fromkk%2FMaskableView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fromkk","download_url":"https://codeload.github.com/fromkk/MaskableView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140537,"owners_count":20729797,"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":[],"created_at":"2024-10-20T22:24:01.177Z","updated_at":"2025-03-29T04:41:15.748Z","avatar_url":"https://github.com/fromkk.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MaskableView\n\nMaskableView is able to add any masks to UIView with Swift 3.\n\n---\n\n# Required\n\n- Xcode 8.0 or later\n- iOS 8.0 or later\n- Carthage\n\n---\n\n# Install\n\nAdd `github \"fromkk/MaskableView\"` to **Cartfile** and execute `carthage update` command on your terminal in project directory.  \n\nAdd **Carthage/Build/{Platform}/MaskableView.framework** to **Link Binary with Libralies** in you project.  \nIf you doesn't use Carthage, add **New Run Script Phase** and input `/usr/local/bin/carthage copy-frameworks` in **Build Phases** tab.  \nAdd `$(SRCROOT)/Carthage/Build/{Platform}/MaskableView.framework` to **Input Files**.\n\n---\n\n# Usage\n\nadd `import MaskableView` to top of swift file.\n\n## Simple mask\n\n```swift\nlet redView: UIView = UIView(frame: CGRect(origin: CGPoint.zero, size: CGSize(width: 375.0, height: 667.0)))\nredView.backgroundColor = UIColor.red\n\nlet view: MaskableView = MaskableView(frame: redView.bounds)\nview.backgroundColor = UIColor(white: 0.0, alpha: 0.50)\n\nlet mask: MaskableView.Mask = MaskableView.Mask(frame: CGRect(origin: CGPoint(x: 50.0, y: 50.0), size: CGSize(width: 100.0, height: 60.0)), shape: MaskableView.Mask.Shape.radius(10.0)) { (mask: MaskableView.Mask) in\n    print(\"tapped mask1\")\n}\n\nview.set(mask: mask)\nredView.addSubview(view)\n```\n\n![simple](https://cloud.githubusercontent.com/assets/322930/21514934/37681596-cd0e-11e6-96da-09e367ad5005.png)\n\n## Multiple mask\n\n```swift\nlet redView: UIView = UIView(frame: CGRect(origin: CGPoint.zero, size: CGSize(width: 375.0, height: 667.0)))\nredView.backgroundColor = UIColor.red\n\nlet maskView: MultiMaskableView = MultiMaskableView(frame: redView.bounds)\nmaskView.backgroundColor = UIColor(white: 0.0, alpha: 0.50)\n\nlet mask1: MultiMaskableView.Mask = MultiMaskableView.Mask(frame: CGRect(origin: CGPoint(x: 50.0, y: 50.0), size: CGSize(width: 100.0, height: 60.0)), shape: MultiMaskableView.Mask.Shape.radius(10.0)) { (mask: MultiMaskableView.Mask) in\n    print(\"tapped mask1\")\n}\n\nmaskView.add(mask: mask1)\nmaskView.add(maskFrame: CGRect(origin: CGPoint(x: 50.0, y: 200.0), size: CGSize(width: 50.0, height: 100.0)), shape: MultiMaskableView.Mask.Shape.radius(4.0)) { (mask: MultiMaskableView.Mask) in\n    print(\"tapped mask 2\")\n}\nredView.addSubview(maskView)\n```\n\n![multi](https://cloud.githubusercontent.com/assets/322930/21514909/fde54b04-cd0d-11e6-95f1-780f1d33114e.png)\n\n## Animation mask\n\n```swift\nlet view: UIView = UIView(frame: CGRect(origin: CGPoint.zero, size: CGSize(width: 375.0, height: 667.0)))\nview.backgroundColor = UIColor.blue\n\nlet maskView: AnimationMaskableView = AnimationMaskableView(frame: view.bounds)\nmaskView.backgroundColor = UIColor(white: 0.0, alpha: 0.5)\nmaskView.duration = 2.0\nmaskView.delay = 1.0\n\nmaskView.add(from: MaskableView.Mask(frame: CGRect(origin: CGPoint(x: 50.0, y: 50.0), size: CGSize(width: 1.0, height: 1.0)), shape: MaskableView.Mask.Shape.radius(1.0)), to: MaskableView.Mask(frame: CGRect(origin: CGPoint(x: 50.0, y: 50.0), size: CGSize(width: 200.0, height: 200.0)), shape: MaskableView.Mask.Shape.radius(10.0), tap: { (mask: MaskableView.Mask) in\n    print(\"tapped\")\n}))\n\nmaskView.animationCompletion = {\n\t\t    print(\"completion\")\n}\nview.addSubview(maskView)\n```\n\n![animation](https://cloud.githubusercontent.com/assets/322930/21514918/1cfb4c5a-cd0e-11e6-8ddb-ae1be7bb67a2.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffromkk%2Fmaskableview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffromkk%2Fmaskableview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffromkk%2Fmaskableview/lists"}