I certainly would not say that! Apple has done a lot for the open-source community - most notable probably being their investment in LLVM, but there's a lot more. Their github page has 93 repositories, including FoundationDB, the Darwin XNU kernel, CUPS, etc. Loads of stuff.
Traditionally, platform-specific UI frameworks have not been open-sourced, and it is quite a shift for platform developers to start to do that. Even Apple developing Swift in the open on Github is quite a surprising step (this is Apple remember? Famous for their secrecy).
As I said way earlier in this very long thread, the question of whether companies can assert ownership of proprietary APIs and use that as a competitive advantage is a question currently waiting for the US Supreme Court (Oracle vs Google):
Oracle initiated the suit arguing that the APIs were copyrightable, seeking US$8.8 billion in damages. While two District Court-level jury trials have found in favor of Google, the Federal Circuit court has reversed both decisions, asserting APIs are copyrightable and Google's application of them failed a fair use defense. Google successfully petitioned to the Supreme Court to hear the case in the 2019 term, focusing on the copyrightability of APIs and subsequent fair use. [...]
The case is of significant interest within the tech and software industries, as numerous software programs and libraries, particularly in open source, are developed by recreating the functionality of APIs from commercial or competing products to aid developers in interoperability between different systems or platforms.
Google's fair-use defence was interoperability. As the law stands, duplicating an API to allow your code to work on other platforms is a breach of copyright.
That said: to my knowledge, Apple has only very rarely enforced their ownership over an API (I only know of one time, related to Samsung's copying of a gesture API. IIRC it was actually a patent rather than copyright, and I don't think they succeeded). There are plenty of reimplementations of UIKit floating around, and I've never heard of Apple prosecuting any of them - in fact, one of them is maintained by Microsoft! It includes loads of surrounding system frameworks. You could not have a more blatant violation of Apple's API copyrights, but I don't remember any legal challenges in the press. If this was Oracle, no way that flies. I've never heard of any of these open-source SwiftUI clones being prosecuted, either.
Maybe that's evidence that platform holders don't need to protect their proprietary APIs as tightly as they have in the past? Depending on what the supreme court rules, it may become impossible for them to prevent anybody creating a
swift-crypto style wrapper library anyway.
Change is happening, but it takes time. Whenever the Supreme Court makes a ruling (obviously their timetable has slipped a bit), I'd expect Apple to review the situation.