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
{{ message }}
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.
Is there any reason why the initializers, containing the viewClass argument, are marked internal? It would be extremely useful if they were exposed as public.
Reason:
Let's say for example you want to define a SizeLayout and you want to determine what UITextField.Type you want to use at runtime, the current public initializers for SizeLayout prevents you from doing so.
func createSizeLayout<T:UITextField>(type:T.Type)->SizeLayout<T>{.... logic for creation here ...}lettextFieldLayout=createSizeLayout(type:YourCustomTextField.self) // this inferred as SizeLayout<UITextField>
// if you follow the initialization steps, the used initializer in BaseLayout is:
publicinit(alignment:Alignment, flexibility:Flexibility, viewReuseId:String?=nil, config:((V)->Void)?){self.alignment = alignment
self.flexibility = flexibility
self.viewReuseId = viewReuseId
self.viewClass =V.self
self.config = config
}
// instead of:
init(alignment:Alignment, flexibility:Flexibility, viewReuseId:String?=nil, viewClass:V.Type, config:((V)->Void)?){self.alignment = alignment
self.flexibility = flexibility
self.viewReuseId = viewReuseId
self.viewClass = viewClass
self.config = config
}
Using the latter will still yield an inferred type of SizeLayout<UITextField> BUT if you set breakpoints in the config closure it will be a YourCustomTextField instance.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi there,
Is there any reason why the initializers, containing the viewClass argument, are marked internal? It would be extremely useful if they were exposed as public.
Reason:
Let's say for example you want to define a SizeLayout and you want to determine what UITextField.Type you want to use at runtime, the current public initializers for SizeLayout prevents you from doing so.
Using the latter will still yield an inferred type of
SizeLayout<UITextField>
BUT if you set breakpoints in theconfig
closure it will be a YourCustomTextField instance.The text was updated successfully, but these errors were encountered: