{"id":21437606,"url":"https://github.com/gabrieltheodoropoulos/gtblurview","last_synced_at":"2025-03-16T23:41:48.227Z","repository":{"id":63910811,"uuid":"283267830","full_name":"gabrieltheodoropoulos/GTBlurView","owner":"gabrieltheodoropoulos","description":"Add blur effect to any view in iOS based projects using a simple, modern and declarative way. Available as a Swift package.","archived":false,"fork":false,"pushed_at":"2020-07-29T09:46:58.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T14:55:24.257Z","etag":null,"topics":["blur","blureffects","blurview","ios","swift","swiftpackage","uikit"],"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/gabrieltheodoropoulos.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":"2020-07-28T16:27:19.000Z","updated_at":"2020-07-29T16:04:31.000Z","dependencies_parsed_at":"2023-01-14T13:16:04.466Z","dependency_job_id":null,"html_url":"https://github.com/gabrieltheodoropoulos/GTBlurView","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrieltheodoropoulos%2FGTBlurView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrieltheodoropoulos%2FGTBlurView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrieltheodoropoulos%2FGTBlurView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrieltheodoropoulos%2FGTBlurView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabrieltheodoropoulos","download_url":"https://codeload.github.com/gabrieltheodoropoulos/GTBlurView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243950792,"owners_count":20373664,"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":["blur","blureffects","blurview","ios","swift","swiftpackage","uikit"],"created_at":"2024-11-23T00:27:45.453Z","updated_at":"2025-03-16T23:41:48.202Z","avatar_url":"https://github.com/gabrieltheodoropoulos.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GTBlurView\n\n![Language](https://img.shields.io/badge/Language-Swift-orange)\n![Platform](https://img.shields.io/badge/Platform-iOS-lightgrey)\n![License](https://img.shields.io/badge/License-MIT-brightgreen)\n![Version](https://img.shields.io/badge/Version-1.0.2-blue)\n\n#### Add blur effect to any view in a simple, modern and declarative way.\n\n## About\n\nGTBlurView is a Swift library that allows to add blur effect to any view with or without vibrancy in a modern and declarative fashion. Made for UIKit based projects on iOS.\n\n## Integrating GTBlurView\n\nTo integrate `GTBlurView` into your projects follow the next steps:\n\n1. Copy the repository's URL to GitHub.\n2. Open your project in Xcode.\n3. Go to menu **File \u003e Swift Packages \u003e Add Package Dependency...**.\n4. Paste the URL, select the package when it appears and click Next.\n5. In the *Rules* leave the default option selected (*Up to Next Major*) and click Next.\n6. Select the *GTBlurView* package and select the *Target* to add to; click Finish.\n7. In Xcode, select your project in the Project navigator and go to *General* tab.\n8. Add GTBlurView framework under *Frameworks, Libraries, and Embedded Content* section.\n\nDon't forget to import `GTBlurView` module anywhere you are about to use it:\n\n```swift\nimport GTBlurView\n```\n\n## Public API\n\n```swift\n\n// -- Class Methods\n\n// Create a `GTBlurView` view with a blur effect visual effect view\n// and add it to the given parent view.\naddBlur(to:)\n\n// Remove the `GTBlurView` instance and all of its subviews from the given view.\nremove(from:)\n\n// Remove `GTBlurView` instance and all of its subviews from the given view animated.\nremoveAnimated(from:duration:completion:)\n\n\n// -- Instance Methods\n\n// Change the default blur style.\nset(style:)\n\n// Add vibrancy to blur effect.\nuseVibrancy()\n\n// Add a subview to vibrancy effect view.\naddVibrancySubview(_:layoutRules:)\n\n// Remove `GTBlurView` instance and its contents on tap.\nremoveOnTap(animated:animationDuration:actionHandler:completion:)\n \n// Show the `GTBlurView` instance containing the blur effect without animation.\nshow()\n\n// Show the `GTBlurView` instance containing the blur effect view animated.\nshowAnimated(duration:completion:)\n\n```\n\n## Usage Example\n\nThe simplest and fastest way to add blur effect to a view is the following:\n\n```swift\nGTBlurView.addBlur(to: self).show()\n\n// or\n\nGTBlurView.addBlur(to: someView).show()\n```\n\nwhere `self` and `someView` are UIView objects.\n\nBlur view can be shown animated as well:\n\n```swift\nGTBlurView.addBlur(to: someView).showAnimated()\n```\n\nAnimation duration and completion handler can be optionally provided. Default animation duration is 0.4 seconds.\n\n```swift\nGTBlurView.addBlur(to: self).showAnimated(duration: 0.25) {\n    // do something upon completion...\n}\n```\n\nBoth `show()` and `showAnimated(duration:completion:)` methods return a `GTBlurView` instance but they are marked with the `@discardableResult` attribute. That way assigning it to a variable or property is optional and Xcode will not show any warnings in case you avoid to do so.\n\n### Blur Effect Style\n\nDefault blur effect style is `.regular`. Override it like so:\n\n```swift\nGTBlurView.addBlur(to: self)\n    .set(style: .dark)\n    .show()\n```\n\n### Remove On Tap\n\nIt's possible to remove blur view by just tapping on it.  Use the `removeOnTap(animated:animationDuration:delay:actionHandler:completion:)` method to enable it.\n\n```swift\nGTBlurView.addBlur(to: self)\n    .removeOnTap(animated: true, animationDuration: 0.25, actionHandler: {\n        // Do something when tapping on GTBlurView instance...\n    }, completion: {\n        // Do something when GTBlurView instance has been removed...\n    })\n    .show()\n```\n\nNote that the only required argument is the `animated` value. All the rest are optional, and pass only those necessary to your implementation. Also:\n\n* `actionHandler` closure can be used to trigger additional actions right when the blur view is tapped.\n* `completion` closure is called when blur view dismissal is finished.\n\n### Use Vibrancy\n\nTo use vibrancy effect along with the blur effect use the `useVibrancy()` method:\n\n```swift\nGTBlurView.addBlur(to: self)\n    .useVibrancy()\n    .show()\n```\n\nTo add subviews to vibrancy's content view call the `addVibrancySubview(_:layoutRules:)` method:\n\n```swift\nlet button = UIButton()\n// Button configuration.\n\nGTBlurView.addBlur(to: someView)\n   .useVibrancy()\n   .addVibrancySubview(button, layoutRules: .auto)\n   .show()\n```\n\nSee the documentation of the `VibrancySubviewsLayoutRules` `enum` for details about laying out subviews to vibrancy effect view.\n\n### Removing Blur View\n\nOne way to remove a blur view is by using the `removeOnTap(animated:animationDuration:delay:actionHandler:completion:)` method as shown above. Besides that, there are two ways to manually remove it:\n\n**Without animation**\n\n```swift\nGTBlurView.addBlur(to: someView).show()\nGTBlurView.remove(from: someView)\n```\n\n**With animation**\n\n```swift\nGTBlurView.addBlur(to: someView).show()\nGTBlurView.removeAnimated(from: someView)\n```\n\nAnimation duration and a completion handler can be optionally provided:\n\n```swift\nGTBlurView.addBlur(to: someView).show()\n\nGTBlurView.removeAnimated(from: someView, duration: 0.25) {\n    // do something once blur view has been removed...\n}\n```\n\n### Putting Everything Together\n\n```swift\nGTBlurView.addBlur(to: self)\n    .set(style: .regular)\n    .useVibrancy()\n    .addVibrancySubview(someView, layoutRules: .none)\n    .removeOnTap(animated: true, animationDuration: 0.25, actionHandler: {\n        // Do something when tapping on GTBlurView instance...\n    }, completion: {\n        // Do something when GTBlurView instance has been removed...\n    })\n    .showAnimated(duration: 0.25)\n```\n\n## Other\n\nTo change blur transparency level you can change the `alpha` value of the returned `GTBlurView` instance by any of the `show()` or `showAnimated(duration:completion:)` methods.\n\nRead the documentation of each method using Xcode's Quick Help for additional details. \n\n## Version\n\nCurrent up-to-date version is 1.0.2.\n\n## License\n\nGTBlurView is licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrieltheodoropoulos%2Fgtblurview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabrieltheodoropoulos%2Fgtblurview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrieltheodoropoulos%2Fgtblurview/lists"}