這裏有一個有趣的挑戰......泛型繼承和斯威夫特編譯
對於一些工作原因,我想automatise所有UITableView
對象,我們在辦公室編寫的管理。問題是,當你有一個應用程序與很多UITableView
對象,你會不斷重複相同的數據採購模式:numberOfRowInSection
,cellForRowAtIndexPath
,等等......
我一直在想這個,我發現了一種自動化所有這種重複數據採購模式的方法:泛型繼承。
代碼太長,不能發佈到這裏,所以我創建了一個GitHub repo here。
您會在Concept文件夾下找到一個遊樂場來演示概念是如何工作的。
在Framework文件夾下,您會發現一種將Playground概念轉換爲Swift框架的非工作方法。到現在爲止,它似乎是一個Swift編譯器錯誤,使其無法正常工作。下面是試圖編譯框架的命令行編譯器會引發什麼:
LLVM ERROR: Broken function found, compilation aborted!
2017-01-12 07:37:36.228 xcodebuild[64275:5358071] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-11766.1/IDEFoundation/Playgrounds/IDEPlaygroundAuxiliarySourceCompilerOperation.m:386
Details: Unable to read diagnostics from file ".../GenericTableViewController/build/GenericTableViewController.build/Debug-iphoneos/GenericTableViewController.build/Objects-normal/armv7/GenericTableViewController.dia" (Invalid File): Invalid diagnostics signature
Function: void XCGenerateDiagnosticsFromFile(NSString *__strong, NSString *__strong, NSDictionary *__strong, NSDictionary *__strong, IDEActivityLogSectionRecorder *__strong, BOOL (^__strong)(IDEActivityLogMessage *__strong))
Thread: <NSThread: 0x7ffb7c2a3f60>{number = 14, name = (null)}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
這是非常奇怪的,因爲相同的代碼工作下一個遊樂場,但一個標準的Xcode項目下沒有編...
能人有助於?
請選擇一個更能描述您的問題的標題。 – Raphael
這個消息很明顯,這是一個(潛在的)錯誤,所以我不確定問題是什麼。 – Raphael
已經解決了,查下回答 –