[{"data":1,"prerenderedAt":270},["ShallowReactive",2],{"project-7845441":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":35,"aspects":36,"strip":41,"post_text":44,"what":45,"said":64,"maker_in_thread":129,"shape":132,"grid":136,"attempts":233,"same_week":234,"maker_shows":39,"maker_hidden":263,"reader_version":264,"card":265},"7845441","swift-2048","2048 in Swift","title","Show HN: 2048 in Swift","https:\u002F\u002Fgithub.com\u002Faustinzheng\u002Fswift-2048","github.com","austinz",1401889229,2014,92,34,307,2272,14,"notable","games","puzzle game","other",[24,25,26,21,27],"2048","swift","ios","objective-c","roasted",-0.25,{"positive":31,"neutral":32,"mixed":33,"critical":34},2,4,0,6,12,{"docs":37,"design":38,"idea":40},{"positive":33,"critical":33},{"positive":39,"critical":31},1,{"positive":39,"critical":32},[33,33,33,33,42,33,42,42,33,33,33,39,33,33,33,33,33,33,33,33,33,43,39,39,42,43,33,33,33,33,33,39,39,39],3,5,null,{"problem":44,"audience":44,"pricing":44,"motivation":46,"time_to_build":44,"stack":53,"openness":62,"stage":63,"team_size":63},{"value":47,"source":48,"evidence":49},"Wanted to try Swift on a reasonably sized project and compare it with an existing Objective-C implementation.","maker",[50],{"id":51,"by":11,"text":52},"7847738","Creator here. Glad people like it! I do have plans for slightly less useless projects in the future, but I did have a couple of reasons for building this particular project: - I…",[54,58],{"value":55,"source":48,"evidence":56},"Swift",[57],{"id":51,"by":11,"text":52},{"value":59,"source":48,"evidence":60},"Objective-C (original implementation)",[61],{"id":51,"by":11,"text":52},"open_source","unknown",{"praise":65,"objections":81,"requests":100,"questions":101,"alternatives":113},[66,74],{"value":67,"source":68,"evidence":69},"Swift code is more readable and concise than Objective-C.","commenter",[70],{"id":71,"by":72,"text":73},"7846754","k-mcgrady","I was playing with it a bit this morning porting a helper XML parsing class[0] I have over to it and building a simple RSS Reader project. I'm one of those people that really…",{"value":75,"source":68,"evidence":76},"Credit to Threes is appreciated.",[77],{"id":78,"by":79,"text":80},"7846445","kin","Kudos for crediting \"Threes\"! That game doesn't get enough credit amidst the popularity of 2048.",[82,93],{"value":83,"source":68,"evidence":84},"Swift lacks private\u002Fpublic access control and exceptions for now.",[85,89],{"id":86,"by":87,"text":88},"7846818","olgagalchenko",">> Still have no idea how to make things private, public, or protected. In Objective-C you could hide internal details away in the .m file. In Swift, everything is exposed by…",{"id":90,"by":91,"text":92},"7846878","dzlobin","I asked a Swift engineer named Greg about this yesterday at a Swift lab at WWDC -- he said that it is forthcoming, but gave no estimates or timelines. Exception handling,…",{"value":94,"source":68,"evidence":95},"Code example syntax (case let) is awkward.",[96],{"id":97,"by":98,"text":99},"7847195","JoshTriplett","> case let .NoAction(_, v): return v That's amazingly awkward syntax for a brand-new language. \"case let\"? In many other languages with pattern matching and destructuring, the…",[],[102],{"value":103,"source":68,"evidence":104},"How do enums with associated values and pattern matching work in Swift?",[105,109],{"id":106,"by":107,"text":108},"7846790","seanalltogether","Can someone give a quick overview of whats going on with this code? I'm feeling a bit lost on how enums are being declared and used in swift. ``` enum ActionToken { case…",{"id":110,"by":111,"text":112},"7846851","TheCoreh","Swift's enums are like Rust's enums, so they're much more powerful than C's enums: In C an enum can assume one of multiple predefined values of type `int`. In Swift an enum can…",[114,125],{"value":115,"source":68,"evidence":116},"2048 implementations in other languages such as Go and Rust-style enums",[117,121],{"id":118,"by":119,"text":120},"7846103","talhof8","I guess this whole \"X in Go\" trend is now being replaced with \"X in Swift\"",{"id":122,"by":123,"text":124},"7846974","sampo","It's the same as case classes and pattern matching in Scala [1]. Or case expression and pattern matching in Haskell [2]. Or in OCaml [3]. Or in Rust [4]. [1]…",{"value":126,"source":68,"evidence":127},"Threes",[128],{"id":78,"by":79,"text":80},{"comments":39,"answered":33,"key":130},[131],{"id":51,"text":52},{"commenters":133,"max_depth":32,"maker_replies":39,"first_comment_mins":134,"lifespan_hours":135},32,107,21,[137,139,141,144,147,149,151,154,156,159,162,163,165,169,172,174,177,180,183,186,189,192,194,196,199,203,206,209,213,216,219,221,225,229],[86,33,33,138,87,33],"commenter\u002Fneutral\u002Fdocs",[90,33,33,140,91,33],"other\u002Fneutral\u002Fnone",[142,33,33,140,143,33],"7846952","joncooper",[145,33,33,140,146,33],"7848259","terhechte",[106,39,42,148,107,33],"project\u002Fneutral\u002Fdocs",[110,39,33,150,111,33],"other\u002Fneutral\u002Fdocs",[152,39,42,148,153,33],"7846973","Glide",[155,39,42,148,107,33],"7847016",[157,39,33,138,158,33],"7847407","weego",[160,39,33,140,161,33],"7847120","Someone",[122,39,33,140,123,33],[97,39,39,164,98,33],"project\u002Fcritical\u002Fdesign",[166,39,33,167,168,33],"7847683","commenter\u002Fneutral\u002Fdesign","thinkpad20",[170,39,33,138,171,33],"7847929","yeldarb",[51,31,33,173,11,39],"maker\u002Fneutral\u002Fidea",[175,42,33,140,176,33],"7846300","unfunco",[178,42,33,140,179,33],"7847286","nkvoll",[181,42,33,140,182,33],"7847608","GuiA",[184,42,33,140,185,33],"7851205","TazeTSchnitzel",[187,32,33,140,188,33],"7846262","Zaheer",[190,32,33,140,191,33],"7847321","AH4oFVbPT4f8",[71,43,43,193,72,33],"project\u002Fpositive\u002Fdesign",[118,34,39,195,119,33],"project\u002Fcritical\u002Fidea",[197,34,39,195,198,33],"7846107","dllthomas",[200,34,42,201,202,33],"7846860","project\u002Fneutral\u002Fidea","tvon",[78,204,43,205,79,33],7,"project\u002Fpositive\u002Fidea",[207,204,33,140,208,33],"7847132","saumotions",[210,211,33,140,212,33],"7846304",8,"callmeed",[214,211,33,140,215,33],"7846356","williwu",[217,211,33,140,218,33],"7847214","visarga",[220,211,33,140,72,33],"7846794",[222,223,39,195,224,33],"7847506",9,"oscargrouch",[226,227,39,195,228,33],"7847257",10,"ndomin",[230,231,39,164,232,33],"7846767",11,"klaussilveira",[],[235,240,244,249,254,258],{"id":236,"name":237,"points":238,"category":239},"7847440","Card",376,"web_saas",{"id":241,"name":242,"points":243,"category":239},"7823167","Mighty Spring",159,{"id":245,"name":246,"points":247,"category":248},"7844264","zzzz.io",156,"infrastructure",{"id":250,"name":251,"points":252,"category":253},"7822894","Biomorphs",117,"learning_science",{"id":255,"name":256,"points":257,"category":239},"7825961","FiveStar.io",75,{"id":259,"name":260,"points":261,"category":262},"7844672","ThriftPy",64,"languages",false,"v2",{"id":266,"name":5,"line":6,"ai":263,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":29,"top":18,"kw":267,"maker":11,"domain":10,"tier":19,"attempts":33,"strip":268,"url":9,"mix":269,"praise":67,"objection":83,"sub":21},7845441,[24,25,26,21,27],"0000303300010000000005113500000111",[31,32,33,34],1793990906202]