import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
默認只有30秒,可以showTimeLine中修改
Failed to obtain sandbox extension for path
URLCache.shared = URLCache(memoryCapacity: 0, diskCapacity: 0, diskPath: nil)
注意設置正確的訪問權限: open, public, fileprivate, private
否則在playground中搜索不到對應的類或者方法
open-同一模塊,外面的模塊可以訪問
Only classes and overridable class members can be declared 'open'; use 'public'
Var cannot be declared both 'final' and 'open'
Cannot inherit from non-open class 'ViewController' outside of its defining module
public-同一模塊,外面的模塊,public修飾類,表示不能被外部模塊繼承。 修飾屬性或者方法,表示不能被外部模塊重寫
internal-同一個模塊
private-定義它的類或者結構體等作用域范圍內使用
fileprivate-同一個文件內, 默認的訪問級別是internal一個swift文件中定義了多個類或結構體
獲取souce目錄路徑
let path = Bundle.main.path(forResource: "xxx", ofType: ".mp4")