- iOS 13.0+
Use Swift Package Manager by adding the following line to Package.swift
:
dependencies: [
.package(url: "https://github.com/Chaehui-Seo/ReededGlassView.git", from: "1.0.1")
]
Use Cocoapods by adding the following line to Podfile
:
pod "ReededGlassView", "~> 1.0.1"
Place ReededGlassView
, that you want to apply effect, in the same hierarchy of the target image view (more specifically, above image view)
// Hierarchy example
Background View
└── Target Image View (Image behind)
└── Reeded Glass View (view to apply effect)
Set reeded glass effect with a public method like below
reededGlassView.applyReededGlassEffect(with: targetImageView)
reededGlassView.applyReededGlassEffect(with: targetImageView, widthType: .narrow) // Adding width type is available. (Default value is WidthType.default)
You can choose width type (among narrow, default, wide)
narrow | default | wide |
---|---|---|
// You can set the width type when applying the effect in the first place by adding a parameter,
reededGlassView.applyReededGlassEffect(with: targetImageView, widthType: .default)
// or you can also set it using a separate method.
reededGlassView.setWidthType(to: .default) // .narrow, .wide
You can run the SampleApp Project located in SampleApp
folder.
All the functions provided by the package are testable through the SampleApp project.
(It takes some time to apply effects. A Spinner is added to express loading in the SampleApp.)
- The target image view and the reeded glass view must be in the SAME HIERARCHY.
- The target image view MUST BE SAME OR BIGGER than the reeded glass view above.