Skip to content

Commit

Permalink
Merge pull request #11 from mikemee/patch-1
Browse files Browse the repository at this point in the history
Improved phrasing & corrected minor grammar errors
  • Loading branch information
angelolloqui authored Jun 2, 2017
2 parents fdd825b + dc9ebc5 commit 1635c4e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,31 @@ It comes with a desktop Mac application to copy & paste your code, as well as a
## Why use SwiftKotlin?

### Why Kotlin?
Kotlin is a great language, it is to Android/Java what Swift is to iOS/Objective-C. It adds lots of great features while at the same time it keeps complete interop to Java, which means that you can combine them both together at your best preference.
Kotlin is a great language, it is to Android/Java what Swift is to iOS/Objective-C. It adds lots of great features while at the same time it keeps complete interop with Java, which means that you can combine them both together as you prefer.

**If you are a Swift developer**, you will love Kotlin. It provides the most important Swift features (optionals, extensions, generics, lambdas,...) and a very similar syntax. You can check a [side by side comparison of Swift and Kotlin here](https://nilhcem.github.io/swift-is-like-kotlin/).

**If you are a Java developer**, you will find in Kotlin a much more modern and safer language (optionals and mutation). It is a pleasure to write Kotlin code, much more readable and compact that the Java counterpart. You can check some of the [benefits and differences in Kotlin official documentation](https://kotlinlang.org/docs/reference/comparison-to-java.html) and a [nice list of reasons to chose Kotlin over Java](https://medium.freecodecamp.com/why-kotlin-is-my-next-programming-language-c25c001e26e3#.hjam7bscd)

Moreover, Kotlin is fully integrated in IntelliJ (Android Studio), so you can keep using the "de facto" IDE for Android with all the added benefits brought by Google, and it even have a Java to Kotlin converter if you want to update your legacy Java.
Moreover, Kotlin is fully integrated in IntelliJ (Android Studio), so you can keep using the "de facto" IDE for Android with all the added benefits brought by Google, and it even has a Java to Kotlin converter if you want to update your legacy Java.

On top of that, if you consider the similarities between Swift and Kotlin, you can very easily convert code in one language to the other one, and have Swift developers writing Kotlin (and viciversa) with ease. That is in fact the porpose of this project, to help you doing that conversion.
On top of that, if you consider the similarities between Swift and Kotlin, you can easily convert code in one language to the other one, and have Swift developers writing Kotlin (and viciversa) with ease. That is in fact the purpose of this project, to help you with that conversion.


### Benefits over shared code accross platforms
There are many alternatives for making multiplatform projects or sharing code between them. Some alternatives are [Xamarin](https://www.xamarin.com/), [ReactNative](https://facebook.github.io/react-native/), [Cordova](https://cordova.apache.org/) or low level C++ libraries.

The main issue with all of them is that once you chose to use them, you need to keep in their boundaries, including specific tools and libraries, introducing a steep learning curve and a big risk in terms of dependency to that 3rd party. Besides that, in many of those options the resulting app will lack the quality of a fully native app.
The main issue with all of them is that once you chose to use them, you need to keep in their boundaries, including specific tools and libraries, introducing a steep learning curve and a big risk in terms of dependency on that 3rd party. Besides that, for many of those options the resulting app will lack the quality of a fully native app.

On the other hand, by using Kotlin, you will still have 2 fully native applications, with all the benefits (best quality, performance, best tools per platform -Xcode/Android Studio-, follow platform conventions,...) but at the same time keep very low the extra work required to translate between them due to its similarity to Swift.
On the other hand, by using Kotlin, you will still have 2 fully native applications, with all the benefits (best quality, performance, best tools per platform -Xcode/Android Studio-, follow platform conventions,...), but at the same time minimize the extra work required to translate between them due to the similarity with Swift.

In fact, [I explored an actual example using MVVM+Rx](http://angelolloqui.com/blog/38-Swift-vs-Kotlin-for-real-iOS-Android-apps), where I got between a 50% and 90% of code similarity depending on the layer (non UIKit dependent is much more reusable than UIKit dependent classes of course). It took me around 30% the time to convert the Android version from the iOS version and I did not had SwiftKotlin by then ;)
In fact, [I explored an actual example using MVVM+Rx](http://angelolloqui.com/blog/38-Swift-vs-Kotlin-for-real-iOS-Android-apps), where I got between a 50% and 90% of code similarity depending on the layer (non UIKit dependent is much more reusable than UIKit dependent classes of course). It took me around 30% the time to convert the Android version from the iOS version and I did not have SwiftKotlin then ;)


## Limitations
Despite the similarities, Swift and Kotlin are different languages, with some intrinsic differences in them that can not be fully translated. Besides that, they both run in different environments and have access to very different frameworks and system libraries.
Despite the similarities, Swift and Kotlin are different languages, with some intrinsic differences in them that cannot be fully translated. Besides that, they both run in different environments and have access to very different frameworks and system libraries.

Because of that, this **tool does not have as a goal to produce production ready Kotlin code**, but just a Kotlin translation that **will require manual edition**. For example, things as simple as adding a new item to an array has different method names:
Because of that, this **tool does not have as a goal to produce production ready Kotlin code**, but just a Kotlin translation that **will require manual editing**. For example, things as simple as adding a new item to an array have different method names:

```swift
// Swift 3
Expand All @@ -57,7 +57,7 @@ array.append("This is in Swift")
array.add("This is in Kotlin")
```

The scope of this project is not mapping all existing methods and data types to its Kotlin counterpart, but to translate the language itself. This means that manual editing will be required afterwards, especially when dealing with system libraries, but it is intentional and important that the developer checks the output.
The scope of this project is not mapping all existing methods and data types to their Kotlin counterpart, but to translate the language itself. This means that manual editing will be required afterwards, especially when dealing with system libraries. It is intentional and important that the developer checks the output.


## Status
Expand All @@ -80,7 +80,7 @@ The project is in active development, with many rules still to be implemented. S
- [ ] Foundation types (arrays, maps,...)
- ...

However, with the implemented rules you can get already a pretty decent Kotlin output for many of your classes. The rest will come in future releases.
With the implemented rules you can get already a pretty decent Kotlin output for many of your classes. The rest will come in future releases.


## Installation
Expand Down

0 comments on commit 1635c4e

Please sign in to comment.