You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately I think we cannot do "Trait Variation" for "User Defined Runtime Attributes"
So when we define something, it is for all ipads and iphones
I make a little PoC using NSDataAsset, that can be variated
A data asset named mask
Inside I put just some text file with the wanted value of a maskType
iphone file contains: circle
ipad file contains: ellipse
Then in MaskType I add a code to parse NSDataAsset
publicextensionMaskType{
init(string:String?){....
case "dataAsset":
if let name =params[safe:0],let dataAsset =NSDataAsset(name: name),let value =String(data: dataAsset.data, encoding:.utf8){self.init(string: value)}else{self=.none
}
And finally I use it on my view in storyboard like this dataAsset(mask)
on iphone a circle
on ipad an ellipse
The text was updated successfully, but these errors were encountered:
@phimage Sorry, I didn't see your issue before, add another case is a great idea to support traits. Is it possible to add a case to support UITraitCollection and the original MaskType, then we can do it in the code without another asset file? That may help the users use it easier. And BTW: your example looks very good 👍
Just want to discuss about a potential feature.
Unfortunately I think we cannot do "Trait Variation" for "User Defined Runtime Attributes"
So when we define something, it is for all ipads and iphones
I make a little PoC using
NSDataAsset
, that can be variatedA data asset named mask
Inside I put just some text file with the wanted value of a maskType
Then in
MaskType
I add a code to parse NSDataAssetAnd finally I use it on my view in storyboard like this
dataAsset(mask)
on iphone a circle
on ipad an ellipse
The text was updated successfully, but these errors were encountered: