Last active
August 18, 2022 08:02
-
-
Save YanSte/d2e464dbfa1d67e8a12fb17e63545f04 to your computer and use it in GitHub Desktop.
Describable, Descriptible de classe, struct etc..
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// MARK: - Describable | |
public protocol Describable { | |
var typeName: String { get } | |
static var typeName: String { get } | |
} | |
// MARK: - Describable extensions | |
public extension Describable { | |
var typeName: String { | |
return .init(describing: type(of: self)) | |
} | |
static var typeName: String { | |
return .init(describing: self) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment