4 ms·
Swift and C# Quick Reference – Language Equivalents and Code Examples [pdf]
- _random_ 12y agoBeautiful presentation.
- alkonaut 12y agoIf you find the "classes" section makes no sense, it's because the heading column is one line out of sync with the other columns.
- thejew 12y agoSwift has internal now.
- TazeTSchnitzel 12y agoAnd C# has string interpolation!
- SideburnsOfDoom 12y agoC# will soon have string interpolation. The release date is, I think, still some time later in 2015. it's just the compiler's syntactic sugar around string.Format() but yeah, it looks nice.
- ianhedoesit 12y agoI can't find an accompanying article or anything for this. I'm curious as to why Microsoft would put something like this out? Why make the comparison in the first place? Why compare it to Swift? Also, the code at http://aka.ms/scspostercode http://aka.ms/scspostercode is nice.
- rubyfan 12y agoBecause Swift is perceived as cool and C# is not.
- rubyfan 12y agoDown vote? That was a legit answer. I'm not saying one is cool or not but that document reads like a contrived C# sell sheet for anyone considering Swift.
- thejew 12y agoThey are trying to get you to use Xamarin. See here: https://twitter.com/masters3d/status/571785335702626304 https://twitter.com/masters3d/status/571785335702626304
- ianhedoesit 12y agoAh, great. Thank you. I still find it a bit odd how they have made the connection, especially with a language that doesn't have that much adoption. But maybe that's why I don't work for Microsoft.
- masters3d 12y agoSwift may become the new Javascript if Apple plays their cards right.
- miguelrochefort 12y agoBased on what exactly?
- addicted44 12y agoThey want people to develop their apps using C#/Xamarin, because that greatly reduces the friction in developing Windows Apps.
- edgyswingset 12y agoSpeaking as someone who loves C# and has tried Xamarin ... it ain't ready for iOS yet. A significant amount of iOS development is done in the Designer and Storyboard, and Xamarin falls well short. The addition of needing to use a mac as a buildhost just makes it inconvenient. I definitely see it improving in the future (I personally view Xamarin development as a better option for Android than standard Java), but it's not something I would recommend for an actual workplace to use.
- miguelrochefort 12y agoWhat issues do you have with Xamarin's iOS Designer? I actually prefer it to Xcode's.
- masters3d 12y agoThat was the interesting thing for me when I found it on google. Internal? Pdf title in metadata "SCPoster_RobinReview_v2_print"
- mythz 12y agoAs it's relevant, ServiceStack also provides integration with XCode that lets you generate a typed API for easily consuming C# JSON Web Services in Swift iOS/OSX Apps: https://github.com/ServiceStack/ServiceStack/wiki/Swift-Add-ServiceStack-Reference https://github.com/ServiceStack/ServiceStack/wiki/Swift-Add-...
- Alphasite_ 12y agoWhat I find strange is that some of these examples dont even do the same thing, which is a little odd when you're trying to do a fair comparison. And some weird non optimal syntax on both sides. Im also a not a fan of the pure white, but thats quite a minor complaint.
- masters3d 12y agoI made a couple of tables to keep track of the changes to swift https://github.com/masters3d/SwiftCSharp https://github.com/masters3d/SwiftCSharp
- rdavisau 12y agoI went to an 'Azure Mobile DevCamp' event for iOS a couple of days ago. It was sponsored by Microsoft but run by someone otherwise unaffiliated who ran a mobile development shop coding in each platform's native language. The session was interactive/follow along, the instructor led in swift and I decided to try following along using C#/Xamarin iOS (disclosure: I use Xamarin.iOS daily and am a big fan of C#). On iOS I had worked for a couple of years in obj-c before moving to Xamarin, but hadn't touched swift. Having read comparison articles similar to this, my otherwise uninformed opinion was that swift looked to provided a far more reasonable experience, similar to C# - to the point that I wondered whether it was worth paying the fee for Xamarin to avoid the archaic objective c language. However, there were a few things from the demo that changed my mind (some are apple ecosystem, some are swift): - no first class support for package management, and adding references to to libraries by hand can still be error prone and frustrating. We spent 10 minutes getting the room set up with their cocoapods - lucky me I had NuGet and in a few clicks had the packages installed. - no `await`-style capability - it seems small but nested callbacks is not something I want to have to deal with anymore, and it makes certain patterns unwieldy. - no LINQ query provider style support - making a call to the azure mobile service with a filter and sort clauses required newing up awkward predicate and sort objects and attaching them to a query before running (which then, again, required a callback!). In C# you could use the same syntax you would use if the collection were local - `await table.Where(i=> i.Name.Contains("Bob")).OrderBy(i=> i.LastName).ToListAsync()` - and the clauses would be transparently translated into parameters for the service call. - Lots of "crashes" in the IDE while writing swift code, where the compiler would bomb out and syntax highlighting etc. would be disabled while it sorted itself out again. Swift still seems to be a huge improvement over obj-c, and some of these will be improved as time goes by, but fundamental features like await make a big difference, especially working on mobile where you are often waiting on network calls, user activity etc. And that's all before you even touch the topic of code sharing.
- Osmium 12y ago> We spent 10 minutes getting the room set up with their cocoapods Cocoapods with Swift support is still in beta. You'll probably have a better experience once it's been officially released. > Lots of "crashes" in the IDE while writing swift code, where the compiler would bomb out and syntax highlighting etc. would be disabled while it sorted itself out again. Likewise for this; Xcode is a much better IDE for Objective-C than it is for Swift at the moment, but it is improving (a new beta of Swift 1.2 + Xcode has just been released that fixes a lot of problems).