Then there is the spit on Swift. ...
I won't spit if there are few basic APIs in the system. Many functions only need to be clicked. NET platform needs to be implemented under iOS. For example, the one to be shared today is obviously an attribute of type DateTime, okay?
Strong, standard strong, super strong, strong enough. What can I say? Although C# is also a strongly typed language, there is a great god of implicit type conversion in the world of C#. For the basic operations among Int, Int32 and Int64, type conversion is needed, which is estimated that Java does not need it. You may need C and C++, but I haven't learned this thing at all.
No exception handling. Not without it. The reason may be that Swift is immature. I found a class related to exception handling, but I don't know how to throw an exception. There seems to be no keyword to support this operation at present.
Speak calmly ...
Compared with Objective-C, Swift is a language that can be roughly understood. Probably a mixture of n languages. But it is much better than objective-C.
There is no distinction between public members and private members in Swift language, so in the world of Swift and Objective-C, all class members are * * *. I think what Swift copied. NET is its extension. Extension is like an extension method, isn't it?
In the video of Geek College, the lecturer told us that we can use extensions to realize the function of namespaces. But code compilation will become extremely slow. Do you build it? This situation directly led to my transplant. Net framework source code to Swift. By the way, the Swift language can't be compiled into the static library of Cocoatoouch for the time being. Compiler error, I don't know when it will be fixed ... and so on? But XCode 6.0. 1 came out ~
Text theory
I wrote this article just to enjoy the code. If it's for Mao, it's a spit ... OK, that's it, then I'll code it. ...
Rapidly occurring
Extended NSDate {
func day ofweek()-& gt; Int {
var interval = self . timeintervalsince 1970;
var days = Int(interval/86400);
Return (day 3)% 7;
}
}
I don't know if you can understand how excited I am to see that the editor of my blog can insert Swift code and highlight grammar. WordPress is really a tough guy among tough guys.
The use method is simple. Put the above code into your program, then instantiate an NSDate and call its dayOfWeek method.
Rapidly occurring
var dt = ns date();
var week = dt.dayOfWeek()
Week represents plastic surgery, and 0 to 6 represent Sunday to Saturday respectively.