Create a new OS with swift

I want to create an OS with swift language(I have the competences) but I don't know if swift/apple allows it; then I want to sell it(like apple with IOS,IPadOS etc.)
thanks

iOS and iPadOS are not "sold" as add-on software, they are part and parcel of the iPhone/iPad system. You will need to jailbreak your iPhone/iPad for development, and your users will have to jailbreak their devices to install and use. You won't be able to sell your product on the App Store(s). There is no way you will be able to convince Apple to allow you to install it on an unadulterated device.

In fact, I'd like to know if I can create my own operating system soon and after marketing it

I don't want to sound discouraging, but I'm afraid you are tremendously overestimating chances of creating a commercially successful OS project. But if you don't mind to spend countless hours on this project without ever earning a cent, just for fun and learnings, take a look at wiki.osdev.org. You can find many useful information for OS development, and maybe even find some people who would be interested to join your project. https://wiki.osdev.org/Beginner_Mistakes would be a good place to start.

4 Likes

Thank you, i see this website but i want to know if its possible to use swift for osdev

Swift is an open source project available under a very permissive license, so you can do almost anything you want with it so long as you follow that license, ie don't bring patent claims against the Swift project.

Since commercial OS's are billion-dollar ventures these days, you may be better off porting Swift to an open source OS you like and then contributing the components that interest you, written in Swift, after making sure the other contributors would be okay with that.

You can use Swift for anything you want. How well you can sell it is another question. You might want to look at the Raspberry Pi effort, who are involved with a bare-metal project using Swift.

Thank you so much!

Should be perfectly possible. Prepare yourself for a rocky road though, as you will have to add a bit C and probably also a bit of Assembler. Pure-Swift is – at this point of time – very unlikely, as you have to take care about booting and hardware initialization. Which CPU architecture are you aiming for?

Arm

1 Like

because I want to create a mobile os

I've 3 questions for you: for doing the GUI I can use swiftUI?
Which compiler/IDE I can use?
How can I write the kernel: it's better write it in C and Assembler or it's ok Swift and assembler?
thank you so much

If you write your own SwiftUI with public API identical to Apple’s.

Pretty much any IDE. Xcode is ok.

We know that it is possible to write a kernel in C. We don’t know much about experience of writing a kernel in Swift. You are a pioneer here. Give it a try, and share your learning. I’d be delighted to read about it.

I don’t really understand the part of SwiftUI, and I thought that xcode was only for ios,macos... development

SwiftUI is a private Apple framework that provides one environment for building macOS, iOS, watchOS, and tvOS applications. You can't use SwiftUI from Apple on non-Apple platforms. SwiftUI needs support from a variety of open source and closed source frameworks, ultimately sitting on top of Darwin, the open source Apple kernel and low-level system services. None of the private frameworks, including SwiftUI can be used in a non-Apple environment. Thus, the need to write your own SwiftUI implementation for your new environment.

Xcode can be used to build initial boot images, tools, low-level system libraries, the kernel, etc.. It can run the Swift/Clang compilers to process Swift code, C code, C++ code, assembler, Objective-C/C++ if you want to port the Objective-C runtime.

ok, thank you so much, but how can I write my own SwiftUI?

There is something called OpenSwiftUI that is being implemented by re-engineering SwiftUI based on Apple's documentation and observed behavior. However, SwiftUI is the last thing you need to worry about. You'll need replacements for things like CoreGraphics, CoreAnimation, Metal, CoreData, and all the lower level stuff including a kernel, low-level graphics drivers, file system drivers, etc..

When you say you want to write a mobile O/S, what are you assuming you are starting out with? iOS, for example, is the result of 1000's of man-years of effort starting in the late 1970's. Most of that effort was initially building NextSTEP, which led to OS X, which led to iOS, but parts of the infrastructure dates back to NextSTEP.

I had thought about starting from the kernel, but I don't know where to start

Well, when you need it, you can follow the OpenSwiftUI philosophy of re-engineering SwiftUI to sit on top of whatever graphics subsystems you devise. You'll also need to re-engineer and/or account for Combine, which is also a private Apple framework. I think there are OpenCombine efforts out there.

What mobile platforms are you targeting?

Terms of Service

Privacy Policy

Cookie Policy