1, Is it true that theoritically we can just write everything (all of codes for one project) in the one/main Content.View file ?
Yes
2, Is it right to say that , though point 1 is correct, but for the purpose of being organized, we'd better break one big code into small chunks (separete files) , easier for us to look for and work on.
Absolutely, yes
3, when do I create Swift File and when do I create SwiftUI file ?
Create a SwiftUI file when you are writing a View
.
Create a Swift file when you are creating other kinds of code.
Although, really, it doesn't much matter. A "SwiftUI file" isn't a special kind of file different from a "Swift" file. They are both .swift
files. It's just that Xcode has a template for SwiftUI that includes a skeletal View
struct for you to start with. You can create a new file using either the SwiftUI template or the Swift file template, you just might need to type more stuff on your own.
For instance, I sometimes start a SwiftUI View
from a regular Swift file template and manually type in the stuff that Xcode gives you for free in the SwiftUI template. Conversely, I sometimes create a new file from the SwiftUI template even though I'm not writing a SwiftUI View
, and I just delete the stuff I don't need.