News for hackers. Stuff that matters.
Re:Swift and C# Quick Reference – Language Equivalents and C... by ianhedoesit on Saturday February 28, 2015 @06:26PM (#9125435)
I 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 is nice.

Re:Swift and C# Quick Reference – Language Equivalents and C... by thejew on Saturday February 28, 2015 @06:37PM (#9125471)
They are trying to get you to use Xamarin. See here: https://twitter.com/masters3d/status/571785335702626304
Re:Swift and C# Quick Reference – Language Equivalents and C... by edgyswingset on Saturday February 28, 2015 @08:15PM (#9125665)
Speaking 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.

Re:Swift and C# Quick Reference – Language Equivalents and C... by taspeotis on Saturday February 28, 2015 @08:49PM (#9125728)
> The addition of needing to use a mac as a buildhost just makes it inconvenient.

I agree it's an inconvenience but I find after the initial setup it works quite well. My workflow is to have a Mac Mini under my desk, with a USB extension lead taped beside my keyboard. Then I plug my iPhone in and once I push F5 Visual Studio talks to the build host which talks to my iPhone and builds/deploys/starts debugging and everything "just works".

The biggest impediment to being productive with Xamarin, in my opinion, is that every second release manages to break something.

Re:Swift and C# Quick Reference – Language Equivalents and C... by pistle on Saturday February 28, 2015 @09:50PM (#9125846)
I would suggest that if you are loading up large storyboards in XCode, then you could be putting yourself in a bad position for a couple of reasons in iOS, let alone trying to make it all come back together using Xamarin.

Storyboards are a decent solutions for certain problems, but if your app ends up as one monolithic or a group of large storyboards, you are going to be structuring and defining things in ways that will have friction with some of your better practices in your C# code.

That's not to say Xamarin "should be a cakewalk, you're doing it wrong." I found pain with dealing with the same area you describe -that back and forth with designs built heavily in storyboard. Not to mention, so many helpful posts on dealing with UI features and quirks seem handled or better handled in plain old NIBs + custom code, etc. Drag and drop layouts with D+D segues are nice, but when the client wants things "just so" I'd end up having to tear things out of the storyboard/designer to get all the things moving and performing well.

The storyboard failed me with AND without Xamarin.

Re:Swift and C# Quick Reference – Language Equivalents and C... by interpol_p on Sunday March 01, 2015 @02:27AM (#9126359)
I have completely stopped using Storyboards and Xibs in my last few projects, two of which have been quite large. I find the code so much better for it. So I wouldn't be put off Xamarin because of a lack of Interface Builder.

I am also really loving Swift when you can use it on its own (I.e., without relying on an older Obj-C based library). The strictness of the type system eliminates many runtime bugs.

Re:Swift and C# Quick Reference – Language Equivalents and C... by UK-AL on Sunday March 01, 2015 @04:33AM (#9126530)
I avoid storyboard, and interface builder. But my xamarin experience has been pretty impressive. They've mapped the APIs on to c# really well.
Re:Swift and C# Quick Reference – Language Equivalents and C... by miguelrochefort on Saturday February 28, 2015 @08:29PM (#9125687)
What issues do you have with Xamarin's iOS Designer? I actually prefer it to Xcode's.
Re:Swift and C# Quick Reference – Language Equivalents and C... by liampronan on Saturday February 28, 2015 @09:20PM (#9125792)
What are your reasons for preferring Xamarin? I've been meaning to try it out but have not gotten around to it
Re:Swift and C# Quick Reference – Language Equivalents and C... by edgyswingset on Saturday February 28, 2015 @08:53PM (#9125736)
It inevitably breaks and freezes up in VS2013 (haven't tried VS2012), particularly when defining screen transitions.
Re:Swift and C# Quick Reference – Language Equivalents and C... by ianhedoesit on Saturday February 28, 2015 @07:16PM (#9125555)
Ah, 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.
Re:Swift and C# Quick Reference – Language Equivalents and C... by addicted44 on Saturday February 28, 2015 @09:56PM (#9125870)
They want people to develop their apps using C#/Xamarin, because that greatly reduces the friction in developing Windows Apps.
Re:Swift and C# Quick Reference – Language Equivalents and C... by masters3d on Saturday February 28, 2015 @09:55PM (#9125866)
Swift may become the new Javascript if Apple plays their cards right.
Re:Swift and C# Quick Reference – Language Equivalents and C... by miguelrochefort on Saturday February 28, 2015 @10:50PM (#9125973)
Based on what exactly?
Re:Swift and C# Quick Reference – Language Equivalents and C... by masters3d on Saturday February 28, 2015 @09:49PM (#9125844)
I think that may backfire as I can see more c# people moving to swift for ios projects.
Re:Swift and C# Quick Reference – Language Equivalents and C... by miguelrochefort on Saturday February 28, 2015 @10:48PM (#9125966)
Why would any C# developer switch to Swift for iOS development when they can already use C# for iOS, Android and Windows development? Especially considering the fact that C# is actually a nicer language and environment to work with than both Swift and Java.

Your suggestion makes no sense to me.

Re:Swift and C# Quick Reference – Language Equivalents and C... by pjmlp on Sunday March 01, 2015 @02:32AM (#9126362)
I guess it depends on how they see themselves.

For example I am not a C# developer, rather a developer.

I use whatever technology stack our customers require us to do. I change project almost every year.

So I can imagine some customers would have iOS only projects and in those cases I would try to push for Swift instead of Objective-C.

Re:Swift and C# Quick Reference – Language Equivalents and C... by UK-AL on Sunday March 01, 2015 @04:31AM (#9126528)
Most customers would want a solution where code can be shared with ios/android/Mac/PC. Xamarin allows that.
Re:Swift and C# Quick Reference – Language Equivalents and C... by pjmlp on Sunday March 01, 2015 @04:54AM (#9126563)
I am not speaking against it, just how I can see it happening.

On my case, enterprise customers actually went with Cordova for mobile multi-platform. On the few projects I took part on.

For my hobby projects so far I went with C++, as they tend to be small multimedia stuff and I don't feel like paying Xamarin for hobby projects I do with months interval and sometimes are left unfinished when life takes over.

So Native UI + C++ (now C++14) suits me better, although the NDK is a big pain to use and quite limited, but at least Windows Phone and iOS are nicer to use.

If I had to do it professionally on my own company, maybe Xamarin would be an option, specially since Qt seems to be way behind Xamarin in terms of device support.

Re:Swift and C# Quick Reference – Language Equivalents and C... by huuu on Sunday March 01, 2015 @03:12AM (#9126419)
No. It's not only about the language but also about the IDE. Visual Studio is one of the best. Using it with ReSharper is amazing.

And why not setup an iOs project with a portable core project so you could build an Android/Windows phone/other project next to it in the future?

Re:Swift and C# Quick Reference – Language Equivalents and C... by on_and_off on Sunday March 01, 2015 @04:23AM (#9126515)
good luck with that.
Re:Swift and C# Quick Reference – Language Equivalents and C... by masters3d on Saturday February 28, 2015 @09:53PM (#9125858)
That was the interesting thing for me when I found it on google. Internal? Pdf title in metadata "SCPoster_RobinReview_v2_print"
Re:Swift and C# Quick Reference – Language Equivalents and C... by rubyfan on Saturday February 28, 2015 @06:31PM (#9125449)
Because Swift is perceived as cool and C# is not.
Re:Swift and C# Quick Reference – Language Equivalents and C... by rubyfan on Sunday March 01, 2015 @08:25AM (#9126945)
Down 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.
Re:Swift and C# Quick Reference – Language Equivalents and C... by alkonaut on Saturday February 28, 2015 @06:14PM (#9125408)
If you find the "classes" section makes no sense, it's because the heading column is one line out of sync with the other columns.
Re:Swift and C# Quick Reference – Language Equivalents and C... by Alphasite_ on Saturday February 28, 2015 @08:19PM (#9125672)
What 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.

Re:Swift and C# Quick Reference – Language Equivalents and C... by rdavisau on Sunday March 01, 2015 @04:40AM (#9126543)
I 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.

Re:Swift and C# Quick Reference – Language Equivalents and C... by Osmium on Sunday March 01, 2015 @04:52AM (#9126559)
> 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).

Re:Swift and C# Quick Reference – Language Equivalents and C... by pionar on Sunday March 01, 2015 @07:37AM (#9126836)
XCode is a horrible IDE for any language.
Re:Swift and C# Quick Reference – Language Equivalents and C... by hutattedonmyarm on Sunday March 01, 2015 @09:22AM (#9127096)
I think it has improved a lot in the last years,to the point where it'S actually pretty good
Re:Swift and C# Quick Reference – Language Equivalents and C... by mythz on Saturday February 28, 2015 @07:16PM (#9125554)
As 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-...

Re:Swift and C# Quick Reference – Language Equivalents and C... by masters3d on Sunday March 01, 2015 @04:15AM (#9126500)
I made a couple of tables to keep track of the changes to swift https://github.com/masters3d/SwiftCSharp
Re:Swift and C# Quick Reference – Language Equivalents and C... by thejew on Saturday February 28, 2015 @06:24PM (#9125432)
Swift has internal now.
Re:Swift and C# Quick Reference – Language Equivalents and C... by TazeTSchnitzel on Saturday February 28, 2015 @07:42PM (#9125608)
And C# has string interpolation!
Re:Swift and C# Quick Reference – Language Equivalents and C... by SideburnsOfDoom on Sunday March 01, 2015 @06:01AM (#9126686)
C# 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.
Re:Swift and C# Quick Reference – Language Equivalents and C... by _random_ on Saturday February 28, 2015 @05:10PM (#9125235)
Beautiful presentation.