On Sep 12, 2016, at 00:08 , Gerriet M. Denkmann <gerr...@mdenkmann.de> wrote: > > I want to do: > if self.dynamicType == SomeClass { … } > > But the compiler won’t accept this (or any number of variations thereof).
Try this: if self is SomeClass { … } Typically, if you need to use a class in an expression, you’ll need to refer to the metatype instance: if self.dynamicType == SomeClass.self { … } but this would be an exact match. If you want the semantics of “isKindOf” (that is, the object is of the specified class or a subclass) then “is” is the way to go. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com