I have a method where I’m passing a variable list of arguments. I do isKindOfClassfor strings, etc. However how can I determine if an ivar is a BOOL?
I have a method where I’m passing a variable list of arguments. I do
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, not at runtime. BOOL is a primitive type, not a class. Actually BOOL is a signed char.
As a workaround you can wrap a BOOL in a NSNumber to make an Obj-C object from it. Then you can do runtime checks:
EDIT: this code may not work for BOOL because it is encoded as char internally. Refer to this answer for an alternative solution: https://stackoverflow.com/a/7748117/550177