I have a styleable set of attributes and when I'm ...
# getting-started
m
I have a styleable set of attributes and when I'm getting them in Kotlin, I end up having a lot of code that looks like this
Copy code
if (typedArray.hasValue(R.styleable.SomeView_some_attribute)) {
	this.someAttribute = typedArray.getString(R.styleable.SomeView_some_attribute).toString()
}

if (typedArray.hasValue(R.styleable.SomeView_some_other_attribute)) {
	this.someOtherAttribute = typedArray.getIntOrThrow(R.styleable.SomeView_some_other_attribute).toString()
}
Is there a cleaner way to do all this? Some kind of loop or something?