Live data from Hacker News

Swift 5: start your engines

lists.swift.org

131–140 of 186 posts

Re: Swift 5: start your engines

#131
post #75

Earlier quoted context omitted.

For ios : look at the number of various apis you can use to do widget positionning and animations : calayer, uiview spring n struts, constraints, physic based, and yet none compose well with each other. IOS also doesn't have any good tech for offline storage ( core data should be burried once and for all) and swift relies on compile-time codegen hack to provide easy struct serialization, because techs like nscoding r…

Also Apple uses a lot of patterns that lead to goto hell because of NeXT's foundations in the delegate pattern: https://en.wikipedia.org/wiki/Delegation_pattern So you start some sequence (like a new UIViewController) and interact with it via callback events instead of having a single (blocking) thread of execution that waits for the view controller call to return like a function. This makes it virtually impossible t…

I don't think that Core Data is that bad for local storage; it's basically just an ORM.

Re: Swift 5: start your engines

#132
post #27
post #3

Maybe 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…

Go has had breaking changes. You had to run a program to fix your source. https://blog.golang.org/introducing-gofix Swift 4 had very few changes. Most Swift 4 code “upgrades” without any changes. I’ve got two dozens Swift examples that were easy to convert to Swift 4. https://github.com/melling/ios_topics/blob/master/README.md

Your Go link is from before 1.0. AFAIK, since 1.0 breakage has been very rare.

Re: Swift 5: start your engines

#133
post #49

About 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.

You can do it in C++, actually, using Clang’s thread safety attributes:

https://clang.llvm.org/docs/ThreadSafetyAnalysis.html

You can create a dummy ‘lock’ type that just represents being on a certain thread, with corresponding global variables for different named threads.

Re: Swift 5: start your engines

#134
post #75

Earlier quoted context omitted.

>"IOS sdk, on the other hand, has become a bit of a mess, due largely to the pace at which the field is moving ( although not as bad as android)." Could you elaborate on whats messy with these SDKs?

For ios : look at the number of various apis you can use to do widget positionning and animations : calayer, uiview spring n struts, constraints, physic based, and yet none compose well with each other. IOS also doesn't have any good tech for offline storage ( core data should be burried once and for all) and swift relies on compile-time codegen hack to provide easy struct serialization, because techs like nscoding r…

For me it feels like the messaging is pretty clear: use AutoLayout. Springs and struts aren't used anymore, constraints are just a part of how AutoLayout works, and I'm not even sure what you mean by physic based.

Re: Swift 5: start your engines

#135

Earlier quoted context omitted.

I'd use react-native if I were you. I think you'd pick up Swift pretty easily given your polyglot background, but if you already know javascript and you aren't doing something that screams to be native, RN would be my choice. You'll get to work in a familiar language, and get an Android version with much less work than if you do swift. Best resource to start a react native app I'd say is this, it was really easy for…

Don’t use React Native. There is little “native” about React Native. It’s something web “devs” like to convince themselves because they don’t know better. Using merely UIView objects does not mean it is native. It’s not just an abstraction over native. The “great” minds at Facebook have decided to not only offer a JS wrapper around the native APIs and objects, but actually reinvent the wheel on everything. Tables? Le…

LOL just use ruby motion you fool

Re: Swift 5: start your engines

#136
post #2

I 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.

Agreed - 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.

Re: Swift 5: start your engines

#137
post #75

Earlier quoted context omitted.

For ios : look at the number of various apis you can use to do widget positionning and animations : calayer, uiview spring n struts, constraints, physic based, and yet none compose well with each other. IOS also doesn't have any good tech for offline storage ( core data should be burried once and for all) and swift relies on compile-time codegen hack to provide easy struct serialization, because techs like nscoding r…

For me it feels like the messaging is pretty clear: use AutoLayout. Springs and struts aren't used anymore, constraints are just a part of how AutoLayout works, and I'm not even sure what you mean by physic based.

I assumed they were talking about UIDynamics (https://www.bignerdranch.com/blog/uidynamics-in-swift/)

Re: Swift 5: start your engines

#138
post #128

Earlier quoted context omitted.

String operations are also really slow in swift. Python is the same speed or faster

I only remember a very early review of string operation speeds that was pretty bad at times indeed. But that was about Swift 1 and the string implementation has been changed a few times. Do you have any recent source?

Personal experience making the same command line util in python and swift 3 that was parsing code with the same C library (sourcekit) and then doing a bunch of string manipulation after that.

Optimized swift 3 & python were the same speed, with %80 of the time being spent in the C library. I would expect swift would at least be 2x faster in that %20 portion that wasn't sourcekit library.

Re: Swift 5: start your engines

#139
post #44

And 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 because I like to experiment. So, my question is. How…

Regarding iOS and macOS kits, all of the documentation is in Objective-C. The libraries' Obj-C is imported and usable with Swift-only code, but the Swift documentation lazily links you to examples in the Obj-C docs. You have to perform trial-and-error by manually converting the Obj-C examples into the equivalent Swift (which often entails renamed classes, methods, types, etc.). If your projects typically do a lot of…

I think most people just use a string extension to allow

  str.substring(with: 7..
or something similar.

Re: Swift 5: start your engines

#140
post #44

And 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 because I like to experiment. So, my question is. How…

I'd use react-native if I were you. I think you'd pick up Swift pretty easily given your polyglot background, but if you already know javascript and you aren't doing something that screams to be native, RN would be my choice. You'll get to work in a familiar language, and get an Android version with much less work than if you do swift. Best resource to start a react native app I'd say is this, it was really easy for…

IMO flutter.io looks a lot more promising (navigation isn't a mess, for example) but really native is the way to go. I'm biased towards native as that's what I do day to day.

React Native is more fun to work with than PhoneGap though (I've shipped apps with the latter and really hated it).

Post reply on HN