When I try to instantiate a class through "static" method (required from protocol), the compiler don't recognize the initializer, although I pass correct parameters.


The problem is that you are defining a template called "Comment" in your method declaration that is obscuring the real Comment class. You need to give that template argument a different name.
And I believe your JSONSerializable protocol is not defined the way you want it. You can use Self in a protocol to refer to the class implementing the protocol so there is no need for a template. Your protocol could look like this:
protocol JSONSerializable {
class func instanceFrom(json: [String:AnyObject]) -> Self;
}
Then you would implement this method in your Comment class:
class Comment: JSONSerializable {
...
class func instanceFrom(json: [String:AnyObject]) -> Comment {
return Comment(message: "lorem lorem", author: User())
}
}
However, it is preferred in Swift to use initializers instead of class methods:
protocol JSONSerializable {
init(json: [String:AnyObject])
}
class Comment: JSONSerializable {
...
init(json: [String : AnyObject]) {
}
}
Userdefined? or more specifically, what does it's initializer look like?