Lets say I'm creating an SDK for a company called "MyCompany" and its a unique company name. All the library classes are prefixed with "MC" only the main API library class "MyCompany.h" is not. Is this appropriate or should I also prefix that class too?

有帮助吗?

解决方案

I think that's appropriate. To make sure, I'd download some popular SDKs, and see what they do. Like Facebook, and others like that.

Also, note that technically, your class prefixes should be at least 3 characters, unless you're Apple. Per Apple. Although, I don't think a lot of people use that guideline.

Edit: I edited this because I didn't like my first answer...

其他提示

MyCompany.h does not -- should not -- define any linkable symbols. It should only #import the rest of your framework's/library's headers.

Thus, there is no conflict because there are no actual unprefixed symbols defined; there should not be a MyCompany class, for example.

Your proposed naming scheme matches what Apple does as well as what many third-party libraries do.

I think that sounds like a reasonable way to name your library.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top