Skip to content
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

using ConfigPropertiesHandler #233

Conversation

oozoofrog
Copy link
Collaborator

@oozoofrog oozoofrog commented Aug 6, 2022

i have rough idea want showing up.
@gmlwhdtjd

By

  1. handling properties with key that their name
  2. using default initializer for view in UIKit.
  3. handling custom view and UIKit view by CustomConfigurableProperties

ETC

  • principal code is newly added regist() function and that is main result of this idea.

  • all of codes has in rough.

  • UIView and subclasses has same initializer, and in most cases, it's okay to create it directly from the type. for default reference view. additionally, can hand over default reference view instance upon request.

  • adding ConfigPropertiesHandlable for customizable and standardization to regist configurable properties.

  • using regist function for regist prepared configs and, also adding custom configs.

  • CustomConfigurablePropertys also good approach for customzing of properties, i want both. so may this needs priority. currently, CustomConfigurablePropertys more higher priority than registed properties.

  • DefaultConfigurablePropertys now has some logics and contains value, so change name and type to final class ConfigurableProperties and add default static self instance.

@gmlwhdtjd
Copy link
Contributor

A good idea to increase scalability is very clear and good idea.

The only concern is the part of the initializer. Default initializer without argument, it is not essential for swift, so there is a possibility of problems.
As the user can register his own custom view in Defualt, the part seems to be mentioned enough.

@oozoofrog
Copy link
Collaborator Author

oozoofrog commented Aug 7, 2022

A good idea to increase scalability is very clear and good idea.

The only concern is the part of the initializer. Default initializer without argument, it is not essential for swift, so there is a possibility of problems. As the user can register his own custom view in Defualt, the part seems to be mentioned enough.

@gmlwhdtjd

that's right. view in UIKit almost no problem for this. but user view is should be problem.

i have two counterplot about this.

  1. add init() definition to CustomConfigurablePropertys.
  2. change scope to internal of regist function and user use CustomConfigurablePropertys.

... oh it's not two. just one only for CustomConfigurablePropertys.

@oozoofrog
Copy link
Collaborator Author

@gmlwhdtjd oh, i was an idiot. custom view of user can get default reference view at regist.

@oozoofrog
Copy link
Collaborator Author

@gmlwhdtjd
now, regist and using protocol both working.

@oozoofrog
Copy link
Collaborator Author

oozoofrog commented Aug 8, 2022

A good idea to increase scalability is very clear and good idea.
The only concern is the part of the initializer. Default initializer without argument, it is not essential for swift, so there is a possibility of problems. As the user can register his own custom view in Defualt, the part seems to be mentioned enough.

@gmlwhdtjd

that's right. view in UIKit almost no problem for this. but user view is should be problem.

i have two counterplot about this.

  1. add init() definition to CustomConfigurablePropertys.
  2. change scope to internal of regist function and user use CustomConfigurablePropertys.

... oh it's not two. just one only for CustomConfigurablePropertys.

anyway this counterplots was so bad approach. 🤪

@gmlwhdtjd
Copy link
Contributor

I have some idea of remove new() method thoroughly, Give me a second

@oozoofrog
Copy link
Collaborator Author

I have some idea of remove new() method thoroughly, Give me a second

oh my god, oh no you are god.

@gmlwhdtjd
Copy link
Contributor

@oozoofrog

I changed to provide defaultReferenceView unconditionally when registering propertiesHandler.
So even a "view" in UIKit should provide a defaultReferenceView.

And for unregistered views, defaultReferenceView of superclass is used. This wasn't a problem at all, and this way I was able to remove the new() method entirely.

@oozoofrog
Copy link
Collaborator Author

@oozoofrog

I changed to provide defaultReferenceView unconditionally when registering propertiesHandler. So even a "view" in UIKit should provide a defaultReferenceView.

And for unregistered views, defaultReferenceView of superclass is used. This wasn't a problem at all, and this way I was able to remove the new() method entirely.

it seems much more clearly. 👍

@oozoofrog oozoofrog merged commit 38d23d7 into Better-way-to-implement-DefaultConfigurablePropertys Aug 8, 2022
@oozoofrog oozoofrog deleted the Better-way-to-implement-DefaultConfigurablePropertys-an-idea branch August 8, 2022 04:09
oozoofrog added a commit that referenced this pull request Aug 8, 2022
* Crate DefaultConfigurablePropertys as a separate file

* using ConfigPropertiesHandler (#233)

* using ConfigPropertiesHandler

* apply UILabel, UIButton

* apply UIImageView, UIStackView

* add default configurable properties for CustomConfigurableView

* modify DefaultConfigurablePropertys to ConfigurableProperties

* add unregist properties of view type

* CustomConfigurablePropertys has higher priority than registed properties

* separate prepared configurable properties

* regist at create default instance of ConfigurableProperties

* Move accessibility property to UIView's property and clean up the code

* hide regist from outside of module

* remove unnecessary function

* readd removed test

* remove unnecessary init definition from CustomConfigurableProperties

* refactoring default reference view setting

* remove unnecessary test code

* test failed - testCustomRegistedConfigurableViewDefaultConfigurableProperties

* test succeed - testCustomRegistedConfigurableViewDefaultConfigurableProperties

* Change to provide defaultReferenceView unconditionally when registering propertiesHandler

Co-authored-by: gmlwhdtjd <gmlwhdtjd@naver.com>

Co-authored-by: oozoofrog <oozoofrog@gmail.com>
oozoofrog added a commit that referenced this pull request Aug 8, 2022
* deprecate callAsFunction for UIView

* update test

* update readme

* update SwiftLayoutUtil.ViewPrinter to use sublayout(_:) Method

* update ViewPrinterTests

* add comments for anchor combinating functions (#227)

* View printer congifuration (#226)

* add ConfigurationPrintable

* add missing double quotation marks at UIView+ConfigurationPrintable.swift accessibilityLabel propterty

* Change ConfigurableProperty to a user-extensible structure

* Add defaultConfigurablePropertys for UIControl / Provide a way to add other default views

* add accessibilityDefaultConfigurablePropertys

* Changed configurationName to fully express the output format

* add uiImageViewDefaultConfigurablePropertys

* add uiStackViewDefaultConfigurablePropertys & ConfigurationName extension clean up

* update ConfigurableProperty to use custom getter for get value

* add uiButtonDefaultConfigurablePropertys

* change configurationName to configuration

* update Configuration for UIImage, UIFont, UIColor

* add tests for Configuration

* add test for CustomConfigurablePropertys

Co-authored-by: oozoofrog <oozoofrog@gmail.com>

* Add combination anchor method to use CGSize (#228)

* [renaming] defualt -> default (#229)

* Config properties sorting (#230)

- sort config properties
- sort config properties printing results
- update tests

* Change the configuration output of UIImage, UIFont, and UIColor to multi-line comments (#231)

* Better way to implement DefaultConfigurablePropertys (#232)

* Crate DefaultConfigurablePropertys as a separate file

* using ConfigPropertiesHandler (#233)

* using ConfigPropertiesHandler

* apply UILabel, UIButton

* apply UIImageView, UIStackView

* add default configurable properties for CustomConfigurableView

* modify DefaultConfigurablePropertys to ConfigurableProperties

* add unregist properties of view type

* CustomConfigurablePropertys has higher priority than registed properties

* separate prepared configurable properties

* regist at create default instance of ConfigurableProperties

* Move accessibility property to UIView's property and clean up the code

* hide regist from outside of module

* remove unnecessary function

* readd removed test

* remove unnecessary init definition from CustomConfigurableProperties

* refactoring default reference view setting

* remove unnecessary test code

* test failed - testCustomRegistedConfigurableViewDefaultConfigurableProperties

* test succeed - testCustomRegistedConfigurableViewDefaultConfigurableProperties

* Change to provide defaultReferenceView unconditionally when registering propertiesHandler

Co-authored-by: gmlwhdtjd <gmlwhdtjd@naver.com>

Co-authored-by: oozoofrog <oozoofrog@gmail.com>

* update README.md for 2.6.0

Co-authored-by: gmlwhdtjd <gmlwhdtjd@naver.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants