I'd like to have a common protocol for returning a new "random"-ly configured instance of a given class.
In ObjC:
@protocol Random
+ (instancetype)random;
@end
@interface UIColor (Random)
<Random>
@end
@implementation
+ (instancetype)random {
    return [UIColor colorWith...];
}
@end
It works in ObjC, but I can't get it to work in Swift.
In Swift:
protocol Random {
    static func randomExample() -> Self
}
extension UIColor: Random {
    final class func randomExample() -> UIColor {
        return UIColor(red: ...)
    }
}
But this throws errors no matter how I configure it.
 
     
     
    
