2017-09-02 52 views
0

我創建了一個UIViewController(TestViewController.swift),它是我在Test.xcodeproj中創建的,並且想要在另一個abc.xcodeproj中訪問此TestViewController.swift及其方法。無法訪問存在於Pod內的ViewController

示例 -

import Test 

class abcViewController: TestViewController { 
} 

我已經在我的項目的波德文件添加abc.xcodeprojTest.xcodeproj

但我無法繼承abcViewController中的TestViewController。我想用LEGO模式創建我的項目。

請建議什麼應該是正確的方法。

回答

2

由於這是默認值,所以很有可能TestViewController標記爲internal。這可以防止其他模塊看到它,這在使用CocoaPods時就是這種情況。

要解決此問題,TestViewController需要標記爲publicopen

以下Apple documentation涵蓋訪問級別,如果您不熟悉這一點,並希望瞭解公開&開放之間的區別。

+0

我在添加公開課時犯了一個錯誤。它使用open。謝謝 – Rajat