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

Make LGButton open, so subclassable ? #54

Closed
10000TB opened this issue Jan 27, 2019 · 4 comments
Closed

Make LGButton open, so subclassable ? #54

10000TB opened this issue Jan 27, 2019 · 4 comments
Labels

Comments

@10000TB
Copy link

10000TB commented Jan 27, 2019

For example, we need to patch some handy instance functions for the button, I would naturally think we can subclass it, then we can use the shared handy function everywhere, and make UI configs consistent

sth like:

clsss CustomButton: LGButton {
     init(withButtonTitle){
         super.init()
          // custom config
          // ....
     }
    
      func enableButton() {
          self.isEabled = true
          // other custom UI change to enabled button
          // ...
       }
       func disableButton() {
          // counterpart to enableButton.
        }
        
         //.. other functions needed per custom requirements
}
@10000TB
Copy link
Author

10000TB commented Jan 27, 2019

I integrated LGButton as pod module, notice that in swift 4.2 LGButton is public but not open, so xcode throws following error when I tried to subclass it.

Cannot inherit from non-open class 'LGButton' outside of its defining module

Any suggestion ?

@10000TB 10000TB changed the title Is there a way we can subclass LGButton ? Make LGButton open, so subclassable ? Jan 27, 2019
@loregr
Copy link
Owner

loregr commented Jan 29, 2019

@10000TB Thanks for your report. The fix is now available in v1.1.3.

@loregr loregr closed this as completed Jan 29, 2019
@10000TB
Copy link
Author

10000TB commented Mar 12, 2019

@loregr seems like with the new change, it is still not subclassable, there is not a good designated method could be called from super

Must call a designated initializer of the superclass 'LGButton'

@10000TB
Copy link
Author

10000TB commented Mar 12, 2019

sth like super.init(nibName: nil, bundle: nil)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants