13 ms·
Swift 5: start your engines
- __sr__ 9y agoI wish more effort were being made to make it a first class citizen on non-Apple platforms. With the popularity it has enjoyed, it could easily challenge the likes of Go, Python or even Java for server side programming.
- brian_herman 9y agohttps://github.com/vapor/vapor https://github.com/vapor/vapor
- __sr__ 9y agoIt's not just about a framework. Some marketing/evangelism is needed. Those factors were major contributors to the rise of Go. And the Swift community itself needs to work on making it officially available on more platforms. Officially, the only non-Apple platform that is supported is Ubuntu -- not Linux, Ubuntu. It runs on other distributions, but having “official” support for more platforms would be a big step towards acceptability. Most people I've talked to still consider Swift on Linux an experiment. Even C#/.Net Core seem to be more popular on Linux. Having Windows support would make the language more acceptable by cross platform developers -- leading to more high quality libraries being written.
- craigching 9y agoWith a name like 'vapor', I thought this was some sort of joke. But this looks like fun! https://vapor.codes https://vapor.codes. An example from that page: import Vapor let drop = try Droplet() drop.get("hello") { req in return "Hello, world." } try drop.run()
- aplummer 9y agoHey, I'm using Vapor (in production). It's really great to work with and moving fast - feels like the early days of rails. There's a real technical advantage to having the brevity of swift (like ruby) but with the type checking of the compiler. I actually migrated this app from Node.js and it's faster and easier in almost every way (notably lack of 3rd party libraries).
- jrs95 9y agoI've been sort of going back and forth on what I want to work on as a side project, but server side Swift stuff is definitely an option. I love the language, and think it could end up being a really strong competitor in that space. At the moment it's just barely viable though, sadly.
- heja_bruh 9y agoYou should definitely try rust, it's better than its counterparts, rapidly growing, memory safe language with utmost priority on efficiency. Plus its cross-platform too :)
- saagarjha 9y agoAre all of your comments about Rust?
- sidlls 9y agoThere's a reason a meme exists about Rust afficionados on HN.
- __sr__ 9y agoI already use Rust for some stuff, but Rust and Swift don't compete in the same domain -- despite some overlap. Rust is more for Systems Programming whereas Swift is geared towards Application Programming. Of course, you could use them in each other's domains, but there will be challenges.
- xenadu02 9y agoSwift is open-source. You are welcome to contribute support for other platforms!
- colordrops 9y agoThis cliche statement feels trite for such a large project. I'd understand it for a 1000 line JS library, but it makes no sense for a complex language ecosystem that requires multiple full time engineers to maintain.
- xenadu02 9y agoIt isn't my intention to sound "trite". I've personally contributed a little bit to Swift. You don't have to be a compiler genius to help out - you can contribute to Swift Foundation which is almost entirely Swift code and would directly improve cross-platform support. I would also note that saying "I wish more effort were being made" is a bit entitled when you're talking about an open source project. No one working on any open source project owes you anything. If you want the project to get better then find a way to contribute.
- abiox 9y ago> I would also note that saying "I wish more effort were being made" is a bit entitled when you're talking about an open source project. No one working on any open source project owes you anything. no, "i wish" just means "i wish". it doesn't imply anything like "being owed". being "open source" doesn't establish carte blanche to oblige everyone to labor on the project if they dared to have a thought or opinion. > If you want the project to get better then find a way to contribute. there are thousands of projects i'd like to see get better. not everyone has the time, ability, desire or capacity to implement everything they've ever wished for. this is just silly.
- __sr__ 9y agoI am talking about "official" support here. Enterprises are not going to risk using an unofficial port. And unless there is a large scale adoption, it will become another niche language which only the enthusiasts would care about. More importantly, it needs to happen while Swift still has momentum. Once a language gets old enough, it builds a certain kind of reputation. Once that happens, it is almost impossible to introduce it into new domains.
- bjt 9y agoThe linked post talks about concurrency not being a focus until Swift 6 at the earliest. Personally, I don't want to make a commitment to server-side Swift until after that dust has settled.
- bsaul 9y agoI've recently started to investigate web frameworks for swift, and specially the concurrency part. So just to clarify something : current swift web frameworks ( and ios apps for that matter) rely on grand central dispatch, which is a decent library for spawning work on work queues, managed by the OS, and dispatched on OS threads. This type of model is fine and has worked quite well in the past. It is not event loop like node, nor light threads ( like go), nor actors like erlang, but it does work fine. And since swift is fast, it'll probably work just a fine as your python / ruby / node backend. What we're looking for for the future of swift is something better / safer than that. But my personnal conclusion is that it shouldn't prevent you from building regular webservice api with this language.
- Jack4E4B 9y agoHow much work is expected from the developer point of view? I'd love to have an alternative to Go, but no concurrency for me kills Swift right of the gate for server stuff.
- bsaul 9y agoAt the moment, it's mostly the framework's job. You write your handler and call the libs for interacting with i/o. Posting a job ( aka function call) on a queue for async programming is also very very easy. There's nothing like coroutines or channels though. So you're back to mutex and OS thread constraints in terms of the number of spawnable threads.
- Jack4E4B 9y agoThanks for that explanation... so in short is not ready yet. Go's channels is what makes it seamless. So few choices for solid concurrency today.
- jordansmithnz 9y agoAgreed - I'd love to see it more widely adopted. It's a great language. Once both ABI stability and a native concurrency model have been implemented, Swift would be in an even stronger position to take on these languages. I'm not sure that's the sole reason a stronger push hasn't been made yet, but waiting another few years to go after this goal would in some ways be tactful.
- ainar-g 9y agoMaybe someone will explain this to me. Does Swift use this confusing "rapid release" versioning? Does Swift 4 break backwards compatibility with Swift 3? In my company people are looking for a language to rewrite some legacy Objective-C to. Swift is often discarded as "unstable" because of these major version bumps. Compare this to Go, which, seven or so years after the initial release is still 1.x and still doesn't break code. I just don't get breaking the language so often. Do people enjoy rewriting code?
- saagarjha 9y ago> Do people enjoy rewriting code? No, of course not. The way I see it, Swift is scared to go the "Java" route where backwards compatibility is valued above all else, leaving the language an antiquated mess.
- jorgemf 9y agoI want to know the opinion of managers about what they think when they have to rewrite the app everytime there is a new release. I remember all the time the iOs developer spent with every iOs release. He didn't look any happy
- eridius 9y agoYou don't have to "rewrite the app". You run the migrator, then fix up what it didn't migrate. Swift 3 was notorious for having migrator issues, largely due to the fact that it was a pretty radical change and a huge number of method names were changed. Personally, on our hybrid app, the migrator did about 1/3rd of the work, and I did the rest, without any other engineers' involvement. Overall it took maybe 3 days to migrate the whole app.
- jorgemf 9y agoIt was a way of talking. I said it that way because the migration to swift and from swift 1 to swift 2 we had the double of developers for iOs than Android and still have to wait for them because of so many issues they were having. Seems like things are not that bad now. But stills scares me that with every new version you lose a developer for some days (or weeks).
- jorgemf 9y agoSwift developers, how is the evolution of the programming language now? does it still have backwards compatibility issues or things are more stable now (and will be with this new proposals)?
- saagarjha 9y agoThe Swift 3->4 migration was not bad, actually–just a couple of small changes to source here and there. With ABI stability I think we'll see the adoption of Swift for libraries and frameworks increase significantly.
- j-me 9y agoI started out building prototypes with Swift 2. The migration to 3 caused a few headaches for me, and some migraines for others it seems. 3 -> 4 was relatively simple. Though, my experience was far less involved than those depending on Carthage/CocoaPods packages.
- deleted 9y ago[deleted]
- jswny 9y agoCan someone with Swift experience comment on the status of Swift on non-Apple platforms? Is it being used outside of the Apple ecosystem? How is the tooling, deployment, availability/support, etc.
- cgb223 9y agoApparently IBM has some sort of backend product written in Swift. I've never actually seen it in production though, nor have I heard of any of my friends companies either
- jrs95 9y agoThey made a micro framework called Kitura. Maybe some other stuff as well, but I’m not really aware of anyone using it.
- samcat116 9y agoThere are a bunch of server side frameworks and web servers for Linux
- frik 9y agoWould be interested as well. How good is the ecosystem for server side applications on other OS? I like the syntax of Swift, it would be awesome to be able to use it for iOS apps as well as server apps.
- crb002 9y agoVictim of trying it the first week it came out, having to call down into C for anything POSIX, and giving up. If you don't have POSIX bindings, don't call yourself v 1.0.
- saagarjha 9y agoWhat exactly do you mean "call down into C"? You should be able to call C functions directly from Swift, albeit with UnsafePointer and the like.
- protomyth 9y agoOne of the problems I find with Swift is that Apple doesn't go back and properly update their sample code at developer.apple.com. They have examples that will not build. If you search you can find folks that have patch sets, but they really need to fix the examples.
- saagarjha 9y agoFile a Radar and someone will get around to fixing it: http://bugreport.apple.com/ http://bugreport.apple.com/
- protomyth 9y agoYeah, right, that is some serious BS right there. I've filed radars on the Finder (multiple with reproducible crashes), location data, and Quicktime and it holding onto external drives. The only one they have ever fixed is the Quicktime bug but it reappeared later then went away again. Apple is horrible about bugs and providing feedback. Why the heck would I need to file a radar anyway? Doesn't someone at Apple check the examples to make sure they still work? These are the examples Apple uses to promote and teach the language and how to build apps.
- saagarjha 9y ago> Apple is horrible about bugs and providing feedback. Yes, they can be a bit tight-lipped. I have found that they're pretty quick on fixing documentation though. They won't tell you that it's resolved, but it's usually updated within a couple of days. > Doesn't someone at Apple check the examples to make sure they still work? I'd expect that they do, but some slip through the cracks. Maybe on of the Apple engineers in this thread could weigh in?
- chc 9y agoApple are super slipshod about their documentation in general. Hardly a day goes by that I don't get a Stack Overflow comment telling me that some link to Apple's docs is broken.
- 9y ago
- ssijak 9y agoAnd just today I was contemplating writing my first native iOS and macOS app... I was looking at the options and decided to go native with Swift. I have never written Objective-C app and never used x-code for dev. But I have ~10 years of dev experience, mostly Java and Python on the backend and front end dev exp mostly with Angular. Some Android, and a little from <input_random_tech_here> because I like to experiment. So, my question is. How hard and enjoyable is for someone like me to write not very complex native iOS/macOS app in Swift starting from scratch? Best resource to start with?
- caiob 9y agoThis is the question I've been asking my iOS dev buddies, with a catch: I want up-to-date resources. None of them were able to share a link so far.
- ssijak 9y agoYeah, up-to-date was assumed in my post. I don`t want a post about Objective-C from 2012. I don`t know if it is against the guidelines to post this kind of links but I found this https://designcode.io/ https://designcode.io/ (I have 0 affiliations with the product) that looks just like what I need. From 0 to app in the newest stack, would probably buy and try it if somebody does not have something better in mind?
- tarentel 9y agoNo idea how good that book is but that newest stack won't be the newest in maybe a month or so. Assuming that is well written most of it will be applicable or will need only minor updating. That's probably why no iOS dev (from the original comment) can find anything "up to date" because we're right on the edge of a new release.
- LeoNatan25 9y ago> Yeah, up-to-date was assumed in my post. I don`t want a post about Objective-C from 2012. What a ridiculous statement. Most of those resources are excellent and relevant today. An article/blog post on calendrical or localization or accessibility is still as relegate today, as “back in the day” in 2012. This is not some web “dev” nonsense where the “stack” changes every year and a half. iOS and macOS consist of some tried and tested APIs that are decades old.
- bsaul 9y agoAbout concurrency : does anyone know of a language that would let you tag portions of a codebase in some way, and declare something like "all those methods should execute in the same thread". Those declarations would then be checked by the compiler. That would be a first step toward agent like concurrency, but it would be general enough to apply to other types of concurrency models.
- BinaryIdiot 9y agoThat's an interesting concept. Would you also suggest having a way of saying "this method should execute in another thread" or "all of those methods should execute in another thread"?
- bsaul 9y agoI'm still in the process of figuring how that would work. But mostly it would look something like annotation @threading("BACKGROUND_WORK_QUEUE_A") func someWork(data) {} @threading("BACKGROUND_WORK_QUEUE_A") func someSubWork(data) {} @threading("MAIN_QUEUE") func requestHandler() {} and you wouldn't be able to directly call someWork() from requestHandler() directly, but calling someSubWork() from someWork() would be fine. The idea is that i've observed that my code could often be split into parts running in their own threads, and the complex thread splitting code would be at the junction. Adding annotation like that would help me make sure that a function designed to run inside some part wouldn't accidentaly be called directly from another part.
- cmoscoso 9y agoSomething like Agents in Clojure?
- whowouldathunk 9y agoUgh, makes me think of COM https://msdn.microsoft.com/en-us/library/windows/desktop/ms680112(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/ms6...
- int_19h 9y ago
- the_common_man 9y agoGreat to see chris still contributing - https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170807/038662.html https://lists.swift.org/pipermail/swift-evolution/Week-of-Mo...
- tambourine_man 9y agoSince things at Tesla haven't worked out, I hope Lattner eventually returns to Apple. Not that the Swift team is in a bad shape without him, it's just that it's nice to have an amazingly smart guy behind an open source language that many of us use (and that number that will probably only grow).
- lyinsteve 9y agoThere are tons of amazingly-smart people working on Swift at Apple right now
- Jack4E4B 9y agoConcurrency finally, it has taken forever. Is there any built-in support now? Server side Swift is lacking this big time.
- slavapestov 9y agoIt doesn't cover everything, but libdispatch is available on both Darwin and Linux, with a "Swift-ified" API.
- Jack4E4B 9y agoI am not a Swift expert, can you explain your point. How would that situation compare to say programming in Go where there is built-in support for channels, and concurrency?
- RocketSyntax 9y agoI'd rather build hybrid apps. Fix your IDE.
- legulere 9y agoFixing the ABI might be interesting for interoperation with other programming languages
- real-hacker 9y agoThe only complaint about swift programming is: they keep changing the programming interfaces, so if I import a third-party code file written with earlier versions of Swift, I have to go through the errors of 'obsolete APIs', updating the function signatures. The changes are automated by Xcode, but it is still a hassle. I am totally OK with introducing new features of Swift language. But changing the API function signatures (even multiple times) seems totally unnecessary, and reflects the API designers' obsession of naming conventions.
- martijn_himself 9y agoTangential question- I'm in the UK and I am keen to become a iOS developer (I'm currently a senior .NET developer in a large firm). Are there enough opportunities remaining in iOS development as a contractor / creator of ('enterprise') apps to make a living? I would be very grateful if anyone could share any advice / personal experience.
- seekler 9y agoAnyone else doing what swift will do: Inlines the standard library, but distributes it separately. Does not makes sense to me at all.
- geodel 9y ago> the Core Team felt that we could strike a balance with not diluting attention from ABI stability while still enabling a broader range of proposals compared to Swift 4 by requiring that all proposals have an implementation before they are officially reviewed by the Core Team. Good. They are effectively saying 'Talk is cheap, show me the code'
- haterswillhate 9y agoSwift is a disaster from start to end. Every release projects go ape boop broke. Android studio start to be nice tool compared to Xcode..
- apple4ever 9y agoI'm sticking with Objective-C. A much better language than Swift, even at version 5.