2014-07-26(土)に開催された「ReactiveCocoa勉強会関西【Cocoa勉強会関西特別編】」の発表資料です。 https://atnd.org/events/53540Read less
![var RAC3 = ReactiveCocoa + Swift](https://cdn-ak-scissors.b.st-hatena.com/image/square/bb45f4d3eccc0566bfabb9795f2879de7cfa0e2b/height=288;version=1;width=512/https%3A%2F%2Fcdn.slidesharecdn.com%2Fss_thumbnails%2Frac3reactivecocoaswift-140727003154-phpapp01-thumbnail.jpg%3Fwidth%3D640%26height%3D640%26fit%3Dbounds)
Around one month ago my two-part tutorial series on how to use the MVVM pattern with ReactiveCocoa was published on Ray Wenderlich’s website. Unfortunately just before the publication date Apple launched the Swift beta, a language which is much better suited to functional programming than Objective-C. I’ve ported the app to Swift, and the code looks much more elegant as a result. This blog post sh
Jul 23, 2014 AppleのSwift Blogを読んで@auto_closureが面白そうだと思い活用方法を考えてみました。 @auto_closureはclosureを取る引数につけると、呼び出し側はclosureの{}を省略できるようになるというものです。 Swift Blogによると、AppleはSwiftでのassert()などの実装にこれを利用しているそうです。 今回はこれを利用して、条件が成立するまで待つXCTestExpectationを実装してみました。 以下のように使うことができます。 func testBlockOperation() { let queue = NSOperationQueue() let operation = NSBlockOperation(block: { NSThread.sleepForTimeInterval(1.0) })
AppleがWWDC2014にてSwiftを発表してから2ヶ月近くが経ちました。OS X/iOSのアプリ開発に存在するObjective-Cの壁は取り払われ、より多くの人に馴染みやすい言語として現れたSwiftはコミュニティへの新たな開発者の流入を促し既存の開発者にもより安全でモダンなスタイルでの開発を可能にした点でとても歓迎されています。 既に沢山の入門文献や言語の特徴的な振る舞いを解説した文章が日本語で世に出回っていることは承知の上でありますが、最近のbeta 3で変更になった部分やこの2ヶ月で溜まってきたナレッジをもとにあらためて言語からアプリ開発まで一貫した解説記事を残したいと思いました。 本記事の構成はまず速習Swiftで文法の基礎的なところを話し、その後Todoアプリの作成を通じてクラスや構造体、UIKitを用いたアプリ制作の具体的な話をしていきます。読者は他言語を多少触ったこ
関西CVPRML勉強会2018 岡本大和 Unsupervised Feature Learning Via Non-Parametric Instanc...Yamato OKAMOTO
Swiftで面倒なJSONの取り扱いを10倍便利にするSwiftyJSONをもってしても、まだJavaScriptよりも面倒だったのが悔しかったので書きました。 https://github.com/dankogai/swift-json/ Synopsis AnyObjectなSwiftオブジェクトも、こうして JSON Stringにできます。 let obj:[String:AnyObject] = [ "array": [JSON.null, false, 0, "",[],[:]], "object":[ "null": JSON.null, "bool": true, "int": 42, "double": 3.141592653589793, "string": "a α\t弾\n?", "array": [], "object": [:] ], "url":"http:/
I noticed when writing an assert in Swift that the first value is typed as @autoclosure() -> Bool with an overloaded method to return a generic T value, to test existence via the LogicValue protocol. However sticking strictly to the question at hand. It appears to want an @autoclosure that returns a Bool. Writing an actual closure that takes no parameters and returns a Bool does not work, it wants
IntroductionIn this post, we’ll explore building a proof-of concept implementation of Futures and Promises. One of my favorite features of the Swift language is that functions are first-class citizens. Swift’s support for returning functions from functions, accepting functions as function parameters, and Swift’s support for closures let us do some neat things, one of which is building support for
を実装してみました。 https://github.com/dankogai/swift-lazylist 過去にも Perl http://blog.livedoor.jp/dankogai/archives/50839189.html JavaScript https://github.com/dankogai/js-list-lazy などでも実装していて、我ながらどれだけ Lazy List が好きなんだと思いますが、 Swiftのそれは格別に気持ちいいです。 以下、READMEから。 Infinite list let ns = lazylist { $0 } // infinite list of natural numbers println(ns.filter{$0 % 2 == 1}.map{$0 * $0}.take(10)) // [1, 9, 25, 49, 81,
Swiftの言語仕様を読んでいくと、はじめにみつかる特徴的な仕様に、オプション型があります。オプション型とは、名前の通り、必ずしも存在する訳ではない、と言った意味合いがあり、その型そのものの値を含むか、もしくはその値が存在しないことを意味する型です。 他の言語ではNullableなどと呼ばれていることもありますが、Swiftでは全ての型にオプション型が用意されており、IntやDoubleに対しても利用することができます。 JavaではNullableというタイプアノテーションがありますが、これはプリミティブ型(値型)には対応しておらず、C#のNullableは逆に値型にのみ対応しています。Swiftではどちらの種類の型のオプション型を作ることができるため、IntやDoubleなどの型や、独自のクラスのためのオプション型を作ることができます。 1.宣言 var optionalName: S
I was implementing an algorithm in Swift Beta and noticed that the performance was very poor. After digging deeper I realized that one of the bottlenecks was something as simple as sorting arrays. The relevant part is here: let n = 1000000 var x = [Int](repeating: 0, count: n) for i in 0..<n { x[i] = random() } // start clock here let y = sort(x) // stop clock here In C++, a similar operation take
Xcode6で新規のアプリを開発した時に気づいたことをまとめます。 アプリの仕様は以下のとおり。 開発言語はSwift Cocoapodsで既存Objcのライブラリを利用 デプロイターゲットはiOS8以上 Storyboardを利用 AutolayoutとSizeClassesを利用 開発環境は以下のとおり。 Xcode6はBeta2を利用 検証実機はiOS8 beta2をインストールのiPhone5 【頻度中】コンパイルエラーXXXHeaderファイル has been modified since the precompiled header fatal error: file '/Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPho
概要 思ったよりバズったので、いくつか加筆修正しました beta3でArrayの型指定の方法が変わったなーと思って眺めていたら、もっと根本的な変化がありました。 SwiftのArrayがヤバイなどで話題になってたやつです。 公式ドキュメント The Swift Programming Language 変更点 Array in Swift has been completely redesigned to have full value semantics like Dictionary and String have always had in Swift. This resolves various mutability problems – now a 'let' array is completely immutable, and a 'var' array is complet
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く