Need some clarification for iOS Subclassing documentation

I’m currently updating the iOS documentation and needed some clarification. Unless Im mistaken the Subclassing Documentation is about 75 wrong. With the swift example it says you can do things like this.

shield.fireProof = NO;
shield.rupees = 50;

But this has never been true has it? Later on in the documentation it says

The dynamic getter will automatically extract the BOOL or int value and the dynamic setter will automatically wrap the value in an NSNumber . You are free to use either format. Primitive property types are easier to use but NSNumber property types support nil values more clearly.

Is this only true for Objective-C? I’m pretty sure I tried to use this with BOOL in swift and it gave me all sorts of hell.Even back in Obj-C though I remembered having to do NSNumber conversions. That was years ago though. He does the same thing for both Swift and Obj-C.

Next I’m pretty sure the examples are super old. You don’t need to write your own initialization functions, make dispatch tokens, or call [self registerSubclass] (unless you opt out of automatic subclass registration). You just need to inherit the PFSubclassing protocol and subclass PFObject and the rest is history right? I know this is true for Swift but I’m not sure of Objective-C.

Lastly I wanted to verify that this is wrong or at least is a bit misleading.

PFObject supports dynamic synthesizers just like NSManagedObject. Declare a property as you normally would, but use @dynamic rather than @synthesize in your .m file. The following example creates a displayName property in the Armor class:

@interface Armor : PFObject<PFSubclassing>

@property (nonatomic, strong) NSString *displayName;


Because most people using Objective-C would already know that this creates a property where code is concerned the only logical conclusion a person would come to is that this creates a new property aka stored value within the class Armor on Parse with the name displayName which, correct me if I’m wrong, is not true at least for Swift and I’m pretty sure for Objective-C as well. Additionally I think that it’s worth noting that, at least in swift, that the property name must match the name on parse exactly.

Edit: One more thing

If you need more complicated logic than simple property access, you can declare your own methods as well:

@dynamic iconFile;

- (UIImageView *)iconView {
  PFImageView *view = [[PFImageView alloc] initWithImage:kPlaceholderImage];
  view.file = self.iconFile;
  [view loadInBackground];
  return view;

To me this demonstrates nothing. It has a function that has nothing to do with the iconFile property directly. All it demonstrates is that you can write functions and access properties like normal. IMO Even if we assumed other developers where that dumb to need the reassurance, we could sum this up in 2 sentences. We definitely don’t think we need an entire Swift/Objective-C demonstration that utilizes 0 features specific to Parse or PFObject. I actually think this example could actually make developers stop and look for something with more complexity where there is non.

Thanks to whoever reads and answers this. Kinda nervous about making such a big change to the document and just want to double and triple check that my changes would be 100% correct.

Hello there @noobs2ninjas!
Not really sure I fully understood your question, but from what I see, the documentation is correct and works.

Your example with

shield.fireProof = NO;

wouldn’t work on Swift as Swift does not recognise NO as a boolean as Objective-C does, but other than that, if you specify on the subclass that you have a NSManaged variable, a Bool in this case, it should work:

import Foundation

import Parse

class TestClass : PFObject, PFSubclassing {

    @NSManaged var myText: String
    @NSManaged var myBoolean: Bool

    class func parseClassName() -> String {
        return "TestClass"

And then using it regularly as:

let myTest = TestClass.init()
myTest.myText = "Testing"
myTest.myBoolean = false

I hope this helps. And thank you for your effort! The community really appreciates the nice work that people like you do!
Please let me know if I can help with anything else.
Best regards