-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Master #3
base: master
Are you sure you want to change the base?
Master #3
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// SettingsViewController.swift | ||
// Demo | ||
// | ||
// Created by Klevison Matias on 12/7/16. | ||
// Copyright © 2016 Yalantis. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
protocol SettingsSliderChangeable { | ||
|
||
func valueChanged(value: CGFloat) | ||
|
||
} | ||
|
||
final class SettingsViewController: UIViewController { | ||
|
||
@IBOutlet weak var slider: UISlider! | ||
@IBOutlet weak var label: UILabel! | ||
var radius: CGFloat! | ||
var delegate: SettingsSliderChangeable? | ||
|
||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
slider.maximumValue = 100 | ||
slider.minimumValue = 0 | ||
slider.value = Float(radius) | ||
self.label.text = "\(Int(radius!))%" | ||
|
||
} | ||
|
||
@IBAction func valueChanged(_ sender: Any) { | ||
let slider = sender as! UISlider | ||
let currentValue = Int(slider.value) | ||
DispatchQueue.main.async { | ||
self.label.text = "\(currentValue)%" | ||
self.delegate?.valueChanged(value: CGFloat(currentValue)) | ||
} | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,8 +105,8 @@ import UIKit | |
import Accelerate | ||
|
||
public extension UIImage { | ||
public func applyLightEffect() -> UIImage? { | ||
return applyBlurWithRadius(30, tintColor: UIColor(white: 1.0, alpha: 0.3), saturationDeltaFactor: 1.8) | ||
public func applyLightEffect(radius: CGFloat) -> UIImage? { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It has the same radius as UIBlurEffectStyleLight. You mustn't change radius here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my project I don't want to use default UIBlurEffectStyleLight, so why not another value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should create a new effect instead of changing this one |
||
return applyBlurWithRadius(radius, tintColor: UIColor(white: 1.0, alpha: 0.3), saturationDeltaFactor: 1.8) | ||
} | ||
|
||
public func applyExtraLightEffect() -> UIImage? { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If should have a default radius to not break API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let defaultRadius: CGFloat = 30
(line 25) is the default radius.