5 ms·
Could someone please explain what exactly is the “Foundation”?
by meitham 4y ago
Could someone please explain what exactly is the “Foundation”?
- oneplane 4y agoIt's the base framework where types like NSObject, NSString, NSDictionary etc. are defined. It's right there in the article. It also explains why it exists, what others exist, and what a rewrite will bring.
- KyeRussell 4y agoIt’s not respectful to not read the link and instead ask somebody to summarise it for you.
- meitham 4y agoYou’re making the wrong assumption! I have read the article before I asked, and still have no idea what it is! Saying it provides these abstraction NSObject, NSString, NSArray tells me nothing! The article is clearly written towards readers familiar with Apple ecosystem.
- herodotus 4y agoObjective-C is an object-oriented programming language that is essentially a super-set of C. In fact the earliest implementation of Objective C, if I recall correctly, translated Objective-C code to C. The only built in types in Objective-C are the C types, like int, char and so on. The "Foundation" is a set of classes that implement many useful types that all inherit from a superclass called NSObject. The "NS" prefix refers to Next Step, the name of the company that Steve Jobs started and where Foundation was first created. One of the advantages of this scheme is that it is possible to have heterogeneous collections (like an array of objects, where the objects do not all have to be of the same type/class). Underneath the NS foundation (whose headers are all in Objective-C) is something called Core Foundation, which implements the same classes, but in pure C. To do this well requires huge programming discipline, especially around memory management, and much of that pain is taken away by using the NS classes. Swift has already started replacing some of the foundation classes, NSString and NSDictionary, for example, giving them the names String and Dictionary without the cumbersome name-space two letter prefix. I suspect that some of this rewrite may still "bridge" to the CF classes, but in other cases, it would be much better to simply write the class in its entirety in Swift. I hope that helps.
- meitham 4y agoYes absolutely, thank you very much!
- funny_falcon 4y agoGCC still compiles Objective-C as if it is translated on-the-fly to C. Unfortunately, there is no way to get translated source :-( because it happens on AST-like level.
- hnfong 4y agoThe Foundation framework is basically the standard library of Objective C (and thus pretty much the standard library for most of the Apple ecosystem as well).
- iamcreasy 4y agoWhat is the Linux equivalent to Foundation Framework?
- Jensson 4y agoIts an API for the higher level parts of the OS, not the kernel, so that would be distribution dependent on Linux. You would build it on top of linux and make other programs program against it. Windows has WinAPI which is basically the same thing.
- iamcreasy 4y agoThanks! Can you please give a distribution specific example, such as Ubuntu/Redhat?
- wahnfrieden 4y agoThe Foundation framework is a cornerstone of most macOS and iOS apps, providing a large number of ubiquitous abstractions, including NSObject, NSString, NSArray and NSDictionary, and many more.
- antfarm 4y agohttps://developer.apple.com/documentation/foundation https://developer.apple.com/documentation/foundation