I thought NSURL vs NSString would make a nice discussion for the experts here.
Cocoa seems, to me at least, undecided between NSURL and NSString. Many filesystem methods require a NSURL path, (e.g. in the NSDocument class). However, if you want to create a NSURL to a locale path, you have to use fileURL... methods, instead of URL... methods. Also, the NSURL class lacks easy ways to change the path. NSString has many methods for appending or deleting path components. NSString paths are also used many times for writing out data directly. When it comes down to use of use, NSString paths are the thing to do.
My code is littered with going back and forth between NSURL and NSString objects for paths. I don't like it, it is ugly.
It's probably easy to write a category for NSURL to mimic the NSString methods, but then why is such basic functionality not included in the class from the beginning?
Why is cocoa so seemingly confused between NSString and NSURL (or am I the one who is confused)?
And as for the future, will it stay like this or will one win over the other?
NSURL vs NSString: who is the winner?
Cocoa seems, to me at least, undecided between NSURL and NSString. Many filesystem methods require a NSURL path, (e.g. in the NSDocument class). However, if you want to create a NSURL to a locale path, you have to use fileURL... methods, instead of URL... methods. Also, the NSURL class lacks easy ways to change the path. NSString has many methods for appending or deleting path components. NSString paths are also used many times for writing out data directly. When it comes down to use of use, NSString paths are the thing to do.
My code is littered with going back and forth between NSURL and NSString objects for paths. I don't like it, it is ugly.
It's probably easy to write a category for NSURL to mimic the NSString methods, but then why is such basic functionality not included in the class from the beginning?
Why is cocoa so seemingly confused between NSString and NSURL (or am I the one who is confused)?
And as for the future, will it stay like this or will one win over the other?
NSURL vs NSString: who is the winner?