Is Swift for iOS identical to Swift for Mac? - ios

I would like to know is Swift universal for Mac and iOS.
If it's not identical, what are the main difference?
Can a Swift iOS developer develop Mac apps without learning it all over again?
Thanks!

Swift is a language. The swift language will be the same for when you are making IOS apps or Mac applications. When you are making an ios app you are using alot of libraries and framework that help you do things that you would need. So when you try making the Mac applications you will not have access to those same framework and libraries. You would need to learn new ones. It would not take a lot of effort to go from an ios developer to building Mac applications.

As mentioned by #the_pickle, Swift is a language. A language is platform-independent.
iOS and Mac OS are two platforms. They have their own set of frameworks and libraries. As Wikipedia puts it:
A software framework is an abstraction in which software providing
generic functionality can be selectively changed by additional
user-written code, thus providing application-specific software. A
software framework is a universal, reusable software environment that
provides particular functionality as part of a larger software
platform to facilitate development of software applications, products
and solutions. Software frameworks may include support programs,
compilers, code libraries, tool sets, and application programming
interfaces (APIs) that bring together all the different components to
enable development of a project or solution.
What this means is that a framework makes it easy by providing something generic, say a blank view. What the programmer does is use that view and modify it to fit the needs of the software they are making. So they can make that view green, rounded at the corners, semi-transparent, and/or a combination of many other possibilities.
That is where iOS and Mac OS differ. They have their own set of frameworks and libraries. They are nothing but a bunch of stuff that is needed by programmers over and over again. So they make it reusable in the form of a framework, and allow you to customize it.
However, the language (Swift) is still the same. So that means you will call functions, declare and use variables and everything else in the same way.
If you are trying to be an iOS developer, you will need to learn the (general) language Swift, and the (specific) iOS frameworks. If you are trying to be a Mac developer, then you will have to learn the (general) language Swift, and the (specific) Mac frameworks.
Here's a good starting point for you:
Learn about Swift from here:
https://developer.apple.com/swift/resources/
This is a good starting document:
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/index.html
Learn about iOS frameworks starting here:
https://developer.apple.com/library/ios/documentation/Miscellaneous/Conceptual/iPhoneOSTechOverview/iPhoneOSFrameworks/iPhoneOSFrameworks.html
Learn about Mac frameworks starting here:
https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/OSX_Technology_Overview/SystemFrameworks/SystemFrameworks.html
And then get started on learning about putting it all in practice from any online course. Here's a course that takes it easy and is available for free as of now:
https://www.bitfountain.io/

Related

Xcode (swift) vs Unity for isometric 2d mobile-apps - Performace, Package Size

Let's assume I want to develop an isometric 2D mobile-game such as Clash of Clans for example.
My main target would be iOS but of course Android would be nice, too (but not a must-have).
Now I have to decide to either program with Apples XCode (therefore Swift as a language, which I am already pretty familiar with), or develop my game with Unity3D (and therefore C# as a language, which I am also pretty familiar with).
Personally, I don't prefer one over the other.
So much for the set-up.
As I don't have any preferences, I'd like to choose the one that offers the most benefits for my 2.5D game to me.
The questions:
Is there a difference in getting an approval for the App-Store if you program in Swift, or use Unity; C#?
How big is the difference of the published package-size of the app between Unity and XCode?
Does my Unity-written app run as smoothly as my XCode-written app?
I hope you could help me with that.
If I missed some points there, feel free to criticize me and give me your opinions on it.
Greetings
Chriz
Is there a difference in getting an approval for the App-Store if you program in Swift, or use Unity; C#?
No, given this general comparison - there should be nothing here favoring or disallowing one over the other.
How big is the difference of the published package-size of the app between Unity and Xcode?
That is very hard to say. There will be added libraries for Unity inclusion whereas Apple would already have shared libraries apart of the OS - used by every app. Think shared libraries here - only Apple is permitted to do this. Not to be confused with the to be newly released iOS 9 'App Thinning'.
The larger weight will be media/images/bitmaps.
Does my Unity-written app run as smoothly as my XCode-written app?
Since they both end up using OpenGL, the end result should be the same or very similar. Obviously as the OS and device mature - if Unity doesn't leverage it, they could end up giving up performance advantages.
But... the flip side of being so tightly coupled with Swift/iOS/Apple, is you abandon your Android market - and if you are even considering it - I'd suggest Unity based on what you shared if there is a remote possibility you want to deploy to Android, desktops, *TV devices in the future.

Sprite Kit and IOS Development

Just a few questions which I can't find answers to anywhere:
To code games for IOS using Sprite Kit, do you also need to know Objective-C or Swift?
Can you code high quality games without knowing Objective-C or Swift?
Thanks!
SpriteKit is an Apple framework developed for Objective-C / Swift application. So, yes you'll need at least some code basics notions.
"Yes". You might be able to develop game with Unity2D for example, but that would include using another language to write your scripts.
I'll try to expand a little bit previous answer.
SpriteKit is an Apple framework developed for 2D/3D games. It uses Swift or Objective-C. Advantage of using this is that you can be 100% sure that this game will work flawlessly on iOS devices. Disadvantage is that you are locked only to iOS devices. If you have 0 knowledge of Swift or Objective-C, and you wish only to develop for iOS, I would choose Objective-C. It seems a little harder to learn and understand, but compared to Swift to it seems that Objective-C is still (and will be for long time) superior to Swift. Although, it just be my personal preference, because I truly hate Swift. (You can achieve same things in both languages) :)
I started this way, I do not regret.
You can develop games and apps for iOS without knowledge of Objective-C or Swift. You can use programs like Unity, Unreal engine, Corona, Cocos2D/3D. However these programs require learning another language to write your game (c++ or something else). You can also use GameSalad for 2D games. It requires 0 coding, many things are drag and drop, but you do need to understand logic behind it. For example, it wouldn't be programming but it would be coding :)
GameSalad is easy to learn, fun as well, but forget that you will be able to create any serious game logic or more advanced game than 2D platform one. I tried it, but very soon changed to Objective C and XCode.
If you decide to go with learning actual language (which I would strongly suggest), I would recommend either Objective-C or to learn Ionic software. Ionic uses javascript, but when you learn how to make games/apps you can easily distribute it to ANY platform: iOS, Windows mobile, Android...XCode is better software, but learning Ionic has huge advantage, and that is single click to deploy app on any platform.
Good luck.

New to developing iOS apps [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
As someone who has never developed an iOS app but hopes to soon and has never had a Mac (to date) the whole XCode and process for developing apps was a little lost on me.
To start: things like which languages are supported in development was one area I wasn't sure of:
I've seen C, C++ and Objective-C referenced as the languages used to write the apps. But I've also seen JavaScript` + HTML + CSS and .NET as options and a host of other compiled languages, with people arguing if you can or can't use them.
Another thing I wondered about was Xcode, does it support all the mentioned languages? Or is an IDE built for a specific language such as Cocoa ? If it is, then how would someone use JavaScript for example to write the app?
I'm sure this is a fairly simple answer to Apple users, but I had some struggle trying to relate from a non-Apple background.
Updated
Thanks for the great answers and insight, hopefully other this post will be helpful to others who don't have an Apple / iOS background
All three language alternatives that you mentioned are available to iOS application developers *.
Objective-C/C++ offers a way of making native apps for iOS, you produce machine code that runs on the devices. You use Xcode to develop in these languages.
You can build apps in JavaScript + HTML + CSS because iOS comes with a browser. Apple offers a mode that gives your apps a completely native look and feel, so they do look like first-class citizens.
You can build your apps in C# as well by using Mono Touch. This is different from .NET, although the language is the same, because your code is compiled into binary ahead of time. Although using Mono Touch eliminates the learning curve associated with the new language, you need to go through a fair bit of learning to adapt your knowledge of .NET to a different platform.
* Except Cocoa, which is not a language, but a collective name for Apple's frameworks for developing under OS X and iOS.
iOS' native language is Objective-C. While it's true you can use C++ to make apps (Cocos for example, is mostly written in C++) it isn't the 'native language'.
As for the other languages you mention, while it's possible to create apps using them they won't be 'native' normally relying upon another IDE/Library, phone gap or adobe air for example. Most of these also support cross platform development.
Where I work we also use HTML5 to create a 'faux native' interface/experience.
If you're new to iOS it's worth while checking out Apple documentation/sample code at:
https://developer.apple.com
There is a wealth of knowledge there that should set you on the right path. It ins't however, something I'd recommend if you don't have any experience with object orientated programming.
Coming from a C++ background myself, I didn't find it too difficult but have been working on iOS for about 3 years (on and off) and am only just starting to really become truly fluent in it's processes and conventions.
Hope this helps, let me know if you want to know anything specific.

How to develop for multiple platforms

I have made my first app in the Android platform. However this is not the only platform and I want to get my apps published on at least Android and iOS platforms.
I would like to have one developing platform for both platforms. What is the options?
I have now tried Flex, Air with Flash Builder. It seems quite promising but the future seems to be a bit uncertain and are also more expansive.
It would be interesting to have some suggestions about what developing tools to focus on if I would like to develop apps on both Android and iOS.
It depends what kind of apps you want to build (i.e. Games, Content Aggregators, etc.) because each 3rd party "App-Generator" that deploys to multiple platforms has their strengths and weaknesses.
Here's a (brief) list:
Appcelerator's Titanium SDK - leverages mobile-browser-based features, mostly for content-aggregators, simple or core feature list on platforms
Corona - leverages LUA-scripting language for 2d / more simple games and applications; has a growing user-base and community; possible to leverage for core-experience as well
Unity - 3d experience, games, usually for more high-end, premium experiences
If you're going to develop on the platform, I always recommend build to that platform's language since you'll never have to worry about what happens when the language is upgraded and your "app-generator" hasn't upgraded yet.
It will also help you to learn the language on that platform (Java, C#, Objective-C, etc.)
I know it's old topic but for those who are still looking for rapid mobile development there is also Kinetise that is code-less tool and offers also backend system/CMS.
You can use Sybase Unwired Platform. It has Device App Designer which can create applications for Blackberry ,Android and iOS.
If you are aiming for high quality, I don't think there is any other way than going native for each platform. Also keep in mind that different platforms have different UI guidelines and principles, and doing a multiplatform project is not a good enough reason to abandon those guidelines.
I recommend phonegap: http://www.phonegap.com

ExEn (XNA -> iOS, Android) and accelerometers, etc

I've been reading about Andrew Russell's ExEn project and I'm wondering what the flow would be like for creating a WP7 accelerometer-based game and then porting it to another platform, say iOS. Here's what I hope would happen:
Create fully functional game in XNA, avoiding dependance on device
specific items like the 'back' button.
Run the project through ExEn (I have no idea on how this would
happen), creating fully functional iOS game.
Run game on iPhone.
Sorry for that pitiful outline, but I just don't have a solid high-level view after reading about it.
Also, being software conversion, surely it wouldn't totally work. How would you iron out the wrinkles? I assume you'd have to know iOS or Android fairly well to pin it down.
Anyway, if anyone can move me one step closer I would appreciate it.
ExEn is an implementation of a subset of the XNA API that runs on different platforms (including iOS and Android). Put simply, it makes the classes and methods that you use when writing XNA code available to you on these other platforms. (Plus appropriate instructions, examples, etc.)
When using ExEn, the bulk of your code should simply "just work". However in most real-world cases you will need to write at least some platform-specific code (and probably provide some platform-specific assets). In particular to support different device resolutions, and also in cases where you use XNA features not available in ExEn.
At time of writing, ExEn does not implement the XNA/WP7 APIs for accelerometer support. At some time in the future they may be added (either by me or anyone who wants to contribute a patch). ExEn is distributed as source code, so you could even add the necessary support yourself.
The alternative would be to write platform-specific code for the parts of your game that query the accelerometer. Using ExEn does not prevent you from also using the APIs of the underlying platform.
ExEn (on iOS and Android) runs on top of Xamarin's MonoTouch and Mono for Android products. These two products provide C# bindings for the underlying platform APIs. Also, much like ExEn implements the XNA APIs, Mono implements the .NET APIs. These products also provide you with the tools you need (IDE, compiler, debugger, etc).
So the iOS API that you would use is UIAccelerometer (doc). This is exposed in C# via MonoTouch.UIKit.UIAccelerometer (doc). I'll leave looking up the Android equivalents as an exercise.
You can't expect:
porting a game to other platform and don't modify it.
porting a game with special platform inherent abilities to other platform that lacks this abilities, or vice versa

Resources