Created
May 14, 2019 15:45
-
-
Save creaaa/eec1e5963c2ea97948a000d8c75e97a0 to your computer and use it in GitHub Desktop.
Revisions
-
creaaa created this gist
May 14, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ import UIKit class HogeClass {} // 意味: このプロトコルに適合させるクラスは、 // 必ずこのクラス(HogeClass)のサブクラスでなくてはならない // ≒ HogeClassを継承しないといけない // (Self == HogeClass とは書けない) protocol HogeProtocol where Self: HogeClass { func hoge() } // class FugaClass: HogeClass, HogeProtocol { func hoge() { print("hoge!") } } // つまりこれがだめ class PuyoClass: HogeProtocol { func hoge() { print("hoge!") } }