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")