[swift-users] protocol conformance question

Swarbrick, Frank Frank.Swarbrick at efirstbank.com
Wed Jan 10 13:06:44 CST 2018

Is there a way I can specify that all integer types conform to MyProtocol without naming them explicitly like this??

protocol MyProtocol {}
extension String: MyProtocol {}
extension Int: MyProtocol {}
extension UInt8: MyProtocol {}

I tried the following:
extension FixedWidthInteger: MyProtocol {}
but get "error: extension of protocol 'FixedWidthInteger' cannot have an inheritance clause".


The information contained in this electronic communication and any document attached hereto or transmitted herewith is confidential and intended for the exclusive use of the individual or entity named above. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any examination, use, dissemination, distribution or copying of this communication or any part thereof is strictly prohibited. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy this communication. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20180110/2d97db7e/attachment.html>

More information about the swift-users mailing list