[swift-users] Get class of object in Swift 2.3

Nate Birkholz nbirkholz at gmail.com
Thu Nov 10 13:54:50 CST 2016


self.dynamicType doesn't work any more, but type(of: self) is just Swift
3.0 So how do i get the class?

Use case in a unit test:

let bundle = NSBundle(forClass: type(of: self))

-- 
Nate Birkholz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161110/7571fdb8/attachment.html>


More information about the swift-users mailing list