Cloned from https://github.com/Polidea/ios-class-guard.