[swift-evolution] Add transformers to Codable

2017-12-18 Thread Arsen Gasparyan via swift-evolution
Hello everyone, I’m suggesting to add a new way to encode/decode JSON properties for relevantly complex data formats such as regular expressions, well-known text, hex colours, custom date formats. The problem: Image you have a struct called House struct House { let color: UIColor } and i

Re: [swift-evolution] Add conversion String -> Bool

2016-06-04 Thread Arsen Gasparyan via swift-evolution
nd 0 (which indicates false). On Sat, Jun 4, 2016 at 4:14 PM Leonardo Pessoa wrote: > I think it would be interesting if it could also recognise "1" and "yes" > too as it can be useful in some cases. Perhaps have an option for this > converter to be customised. >

[swift-evolution] Add conversion String -> Bool

2016-06-04 Thread Arsen Gasparyan via swift-evolution
Hello, It would be great if we had `init?(_ text: String)` for Bool class. Because sometime when you're processing JSON/XML it can help you a lot. Examples: Bool("true") -> true Bool("false") -> false Bool("TrUE") -> true Bool(" true ") -> nil Bool("1") -> nil Bool("Y") -> nil Bool("whatever") -

Re: [swift-evolution] [SR-933] Rename flatten to flattened

2016-04-10 Thread Arsen Gasparyan via swift-evolution
Ok. Is it final decision? Can I start working on it? On Sun, 10 Apr 2016 at 23:07, Howard Lovatt via swift-evolution < swift-evolution@swift.org> wrote: > Do it to them all: flatMapped, unioned, etc. > > On Monday, 11 April 2016, Dave Abrahams via swift-evolution < > swift-evolution@swift.org> wro

Re: [swift-evolution] Shortcut for creating arrays

2016-04-08 Thread Arsen Gasparyan via swift-evolution
gt; wrote: >>> >>>> Well, you can do this already: >>>> let words = "rats live on no evil star".componentsSeparatedByString(" ") >>>> so I don't know how much a shortcut is needed. >>>> >>>> And given 

[swift-evolution] Shortcut for creating arrays

2016-04-08 Thread Arsen Gasparyan via swift-evolution
Hey guys, Very often we need to create an array strings. It's a routine task and I really like shortcut in Ruby that shortcut makes everyday coding a little bit easier and fun: words = %w[rats live on no evil star] What do you think about adding something like this in Swift? Cheers, Arsen __

[swift-evolution] [SR-933] Rename flatten to flattened

2016-04-07 Thread Arsen Gasparyan via swift-evolution
Hey guys, The 'flatten()' method didn't get the Swift 3 API renaming treatment it should have, to go along with reversed, sorted, joined, etc. As I see Dmitri Gribenko already agree with it but we still have to discuss it here. So what do you think? Implementation: https://github.com/apple/swift/

[swift-evolution] Add stable sort algorithm

2015-12-25 Thread Arsen Gasparyan via swift-evolution
The standard library should provide a stable sorting algorithm, next to the regular, unstable, sort() and sortInPlace(). This needs a proposal to swift-evolution (the design should be trivial, new methods should mirror existing sorting APIs), and implementation. The standard library already contai