-
Notifications
You must be signed in to change notification settings - Fork 780
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
Add custom gradient start point #380
Conversation
Generated by 🚫 danger |
Hello, let gradientValues = ParamType(fromEnum: GradientStartPoint.self)
print(gradientValues.value(at: 0))
// "top"
print(gradientValues.value(at: 4))
// "bottomRight" It's like an array generated from enum values. It works also to generate array of possible values from number interval : private let numberParam = ParamType.number(min: -50, max: 50, interval: 5, ascending: true, unit: "")
// this will generate this array : [-50, -45, -40, -35, ... , 35, 40, 45, 50] So numberParam.value(at: 0) will gives -50. |
I was thinking to add directly a predefined startPoint, but you are right, it will be for the best to add a section to render it. |
Working perfectly @lastMove! Thanks for the tips. One more question, any suggestion how we should update the current example (it won't compile since .custom isn't compatible with the other |
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.
I think it is ready to go👍
self = .custom(start: CGPoint(x: params[safe: 0]?.toDouble() ?? 0, | ||
y: params[safe: 1]?.toDouble() ?? 0), | ||
end: CGPoint(x: params[safe: 2]?.toDouble() ?? 0, | ||
y: params[safe: 3]?.toDouble() ?? 0)) |
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.
Great method from @lastMove for safe extracting data from params
Not really, the gradient example is still broken 😬 Open to any suggestion |
bac8cf0
to
7d6a27f
Compare
…actNameAndParams lowercase the string)
switch name { | ||
case "top": | ||
self = .top | ||
case "topRight": | ||
case "topright": |
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.
haha, I always forgot that.
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.
:) It's error-prone. I saw it when testing with the exemple app.
Should be good know. |
@lastMove thanks for that! |
Close #378
Using
StartPoint.custom(0,0.5,0,0)
, it will render:That may be useful! After a quick first look to update the example app, I have to say that I'm a bit lost with the
ParamType
😨 @lastMove How am I supposed to createParamType
using custom parameters?Missing: