I am making a Swift 3 module. Therefore, I need to know the package associated with the class in this module. In Swift 2, it was:
let bundle = NSBundle(forClass: self.dynamicType)
How do I do this in Swift 3?
Decision:
let bundle = Bundle(for: type(of: self))
let file = Bundle.main.path (forResource: "filename", ofType: "filetype")
Source: https://habr.com/ru/post/1654516/More articles:CakePHP 3 - How to automatically show form errors for several new objects? - phpHow to create a unique constraint for a type string field in EF 6? - c #The function expects arguments and returns a pointer to the void function - c ++How to make Aurelia destroy / recreate a view / viewModel pair without using a router - aureliaC ++ make links take up memory - c ++How to scroll RecyclerView programmatically using specific pixels? - androidRecyclerView vertical scrolling in Android by pixels - androidWhy does MSE calculation in lasso regression give different results? - rUpgrade closure response enclosure - androidJSON Parse Error: Unrecognized token '<' In angular - jsonAll Articles