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

Fixed issues which inhibited subclassing. #58

Merged
merged 1 commit into from
Jan 31, 2019

Conversation

tladesignz
Copy link
Contributor

ImageRow and ImageCell cannot be directly sub-classed, due to it's final modifiers.

Therefore, sub-classing needs to be done like this:
(In this case, it is, because I need a styled cell using a XIB.)

import UIKit
import Eureka
import ImageRow

public final class AvatarCell: PushSelectorCell<UIImage> {

    @IBOutlet weak var avatar: UIImageView!

    public override func update() {
        super.update()

        accessoryType = .none
        editingAccessoryView = .none

        avatar.image = row.value ?? (row as? ImageRowProtocol)?.placeholderImage
    }
}

final class AvatarRow: _ImageRow<AvatarCell>, RowType {

    required init(tag: String?) {
        super.init(tag: tag)

        cellProvider = CellProvider<AvatarCell>(nibName: String(describing: AvatarCell.self))
    }
}

A non-public ImageRowProtocol effectively prevents that.
Additionally, ImagePickerController casts row to ImageRow which we can't fulfill when overriding,
Config options are therefore ignored.
To resolve this, I introduced an ImagePickerProtocol.

Would be great, if you could merge this, so I don't have to rely on my fork.

Thanks a lot!

Benjamin

@mats-claassen mats-claassen merged commit 6ae9c08 into EurekaCommunity:master Jan 31, 2019
@tladesignz
Copy link
Contributor Author

👍

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.

2 participants