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

Allow to use any type like image in experimental UserInfoTaggingProtocol #222

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

phimage
Copy link

@phimage phimage commented Aug 18, 2017

Split into multiples protocol to generate code automatically and be more generic

  • UserInfoConvertibleProtocol is the protocol to conform to use as userInfo
    later variable dictionary inside protocol could be renamed into userInfo

  • UserInfoTaggingProtocol: Same as before except generic on name type, allowing to put image
    Useful with logger like NSLogger

public struct Image: UserInfoTaggingProtocol {
    public var name: UIImage
    public var dictionary: [String: Any] {
        return [XCGNSLoggerLogDestination.Constants.userInfoKeyImage: name]
    }
    public init(_ name: UIImage) {
        self.name = name
    }
}
extension Image {
    static let done = Image(UIImage(named: "doneImage")!)
}
  • UserInfoTagProtocol : a UserInfoTaggingProtocol with one user info defined key, allowing to generate the code automatically. (Extended by Dev and Tag)
    UserInfoTaggingProtocol and UserInfoTagProtocol could be merged, but I keep it separated to do any change on XCGLogger users who have already implemented UserInfoTaggingProtocol

Split into multiples protocol to generate code automatically and be more generic
@DaveWoodCom
Copy link
Owner

Hi @phimage,

I like the look of this, but I need to test it some more before merging it in.

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.

3 participants