読者です 読者をやめる 読者になる 読者になる

quattro_4 scribble

scribble 落書き (調べた事をただ落書きする)

NSScreencast Episode #149 How Bézier Paths Work

How Bézier Paths Work - NSScreencast ベジェ曲線の描画の仕組みを可視化 UIBezierPath 基準点(2点)に対する補助線を描画 interpolatePosition drawPoint startPoint , endPoint , control1 , control2 各辺を移動する点を可視化 それらの点の隣り合う2点を…

NSScreencast Episode #148 Function Composition with CI Filters

Function Composition with CI Filters - NSScreencast Filterをfuncなどを使って実装 typealias Filter = CIImage -> CIImage func func sepia() -> Filter { func blur(radius: Double) -> Filter { func vortex(angle: Double) -> Filter { CIFilter(name…

NSScreencast Episode #147 Core Image

Core Image - NSScreencast SepiaとBlurの効果を画像に適用 白黒画像の白さを立体表現に変換する例 周囲のpixelから計算 blur効果ができる仕組み Core Image Filter Reference let filter = CIFilter(name: "CISepiaTone", withInputParameters: failurable …

NSScreencast Episode #146 Vibrancy and Blur

Vibrancy and Blur - NSScreencast テキスト表示エリアに透けるエフェクト 過去のエピソード Blur - NSScreencast UIVisualEffectView UIBlurEffect [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight] UIBlurEffectStyleDark UIBlurEffectStyleLi…

NSScreencast Episode #145 Share Extensions Part 2

Share Extensions Part 2 - NSScreencast Imgurという画像共有サービス連携のアップロード部分の実装 ImgurApi init session self.sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; self.sessionConfig.HTTPAdditionalHeaders = […

NSScreencast Episode #144 Share Extensions Part 1

Share Extensions Part 1 - NSScreencast imgurという画像共有サービスと連携 imgur: the simple image sharer ImgShare ImgShareKit ImgShareExtension Podfile target 'ImgShare' do pod 'AFNetworking' Add new target in Xcode (ImgShareKit) check Allo…

NSScreencast Episode #143 Flat Map

Flat Map - NSScreencast enum Result<T> { func map<U>(transform: T -> U) -> Result<U> { func flatten<T>(array: [[T]]) -> [T] return array.reduce([]) { $0 + $1 } $0などは引数 [Swift] Closureについてメモ - Qiita flatten() ().flattenは難しい extension Arr</t></u></u></t>…

NSScreencast Episode #142 Error Handling in Swift

Error Handling in Swift - NSScreencast var error: NSError? NSErrorPointer coco style error enum Result { case Success(Box) case Error(String) class Box { var unbox: T init(_ value: T) { unbox = value swiftで右側に実行結果が出る Swift Playg…

NSScreencast Episode #141 Simulating Rope with UIKit Dynamics

Simulating Rope with UIKit Dynamics - NSScreencast ロープにぶら下がった物体のアニメーション ⌘Boom - Creating a rope with UIDynamics bang links.first!.center What does an exclamation mark mean in the Swift language? - Stack Overflow link 〔…

NSScreencast Episode #140 UIAttachments

UIAttachments - NSScreencast buttonを押すとbuttonが漂って、その後落ちるアニメーション buttonTapped animator = UIDynamicAnimator(referenceView: self.view) gravity = UIGravityBehavior(items: [button, label]) var collision = UICollisionBehavi…

NSScreencast Episode #139 Today Extensions in iOS 8

Today Extensions in iOS 8 - NSScreencast Today Extensionの実装 iOS8 Today Extension 通知部分で使える App Extension Programming Guide: App Extensions Increase Your Impact XCode Today Extension product name language swift files Controller Ma…

NSScreencast Episode #138 IBDesignable

IBDesignable - NSScreencast IBDesignableの使い方 iOS 8 and Xcode 6 are available and out of NDA Previewを見ながら実装できる DesignableKit Linked Libraries Build PosterView.swift @IBDesignable class PosterView : UIView var label: UILabel! t…

NSScreencast Episode #137 Fun with UIKit Dynamics

Fun with UIKit Dynamics - NSScreencast 物体の落下の実装 UIKit Dynamics physics engine UIGravityBehavior [self.animator addBehavior:self.gravity]; UICollisionBehavior self.collision.translatesReferenceBoundsIntoBoundary = YES; 角度をずらす…

NSScreencast Episode #136 Clipping Paths

Clipping Paths - NSScreencast ボードゲームを実装する board game Connect Four Connect Four - Play it now at Coolmath-Games.com checkers game GameBoardView updateConstraints ViewController viewDidLoad [self.view addConstraints: wrong aspect …

NSScreencast Episode #135 Animating Constraints

Animating Constraints - NSScreencast 動的にAutoLayoutを設定しアニメーションする 以前のプロジェクトの続き Add properties for constraints and views @property (nonatomic, strong) NSLayoutConstraint *leftWidthConstraint; @property (nonatomic, …

NSScreencast Episode #134 Visual Format Language

Visual Format Language - NSScreencast Visual Format Languageでconstraintsを記述 AutoLayout wordy(冗長な), cumbersome Visual Format Language condensed format horizontal default inferred "|-[headlineView]-|" "H:|-[headlineView]-|" vertical "…

NSScreencast Episode #133 Auto Layout in Code

Auto Layout in Code - NSScreencast コードでAutoLayoutを指定 reason to use code in storyboard, accidentally break with drag and drop NSLayoutConstraint constraintWithItem attribute (引数, 2回?) relatedBy attribute [headlineView addConstrain…

NSScreencast Episode #132 Realm

Realm - NSScreencast realmというmobile databaseを使う realm database podfile pod "Realm" #import <Realm/Realm.h> RLMObject app delegate RLMRealm *realm = [RLMRealm defaultRealm]; [realm beginWriteTransaction]; [realm addObject:car]; [realm commitWriteTra</realm/realm.h>…

NSScreencast Episode #131 Swift JSON Redux Part 2

Swift JSON Redux Part 2 - NSScreencast JSONをparseするライブラリの続き class JSArray<A, B : JSONDecode where B.J == A> : JSONDecode { class func fromJSON(j: JSValue) -> [A]? { let mapped = array.map { B.fromJSON($0) } let results = compact(mapped) generic type parameters </a,>…

NSScreencast Episode #130 Swift JSON Redux - Part 1

Swift JSON Redux - Part 1 - NSScreencast JSONをparseするライブラリ Core JSValue Enum enum JSValue { case JSArray([JSValue]) case JSObject( [ String : JSValue ] ) switch obj { case let s as NSString: return .JSString(s) case let n as NSNumb…

NSScreencast Episode #129 Swift JSON

Swift JSON - NSScreencast SwiftをJSONをパース Obj-Cの方がSwiftよりJSONパースが適当に実装できる parsing JSON (which provides no contracts or type guarantees) can be difficult and tedious in Swift. Many of the problems you are forced to deal…

NSScreencast Episode #128 Swift Networking

Swift Networking - NSScreencast jsonデータをSwiftでダウンロードする let task = session.dataTaskWithURL(url) { (let data, let response, let error) in if let httpResponse = response as? NSHTTPURLResponse { self.running = false running = true…

NSScreencast Episode #127 Swift Operators

Swift Operators - NSScreencast SwiftでOperatorを定義 =~ be guard init The Swift Programming Language: Initialization initとfuncで引数の扱いが違う external first argument struct Celsius init(fromFahrenheit fahrenheit: Double) Celsius(fromFa…

NSScreencast Episode #126 Swift Classes

Swift Classes - NSScreencast Swiftのクラスの仕様 swift -i input_file gem guard-shell inheritance class Dog: Animal { subclass have to specify override func initializer init(name: String) {} super.init(name: "Molly") call superclass super.m…

NSScreencast Episode #125 Swift Basics

Swift Basics - NSScreencast swift not intended to be replacement of objective-c under NDA repl var x = 30 no semicolon let y = 50 constants var count: Int # count: Int: 0 all variable initialized by default value var letter: Character = "A…

NSScreencast Episode #124 Method Swizzling

Method Swizzling - NSScreencast Objective-C runtimeでメソッドの実装を置き換える #import <objc/runtime.h> swizzle - がぶ飲みする、かき混ぜ class_getInstanceMethod class_addMethod method_getImplementation method_getTypeEncoding method_exchangeImplementation</objc/runtime.h>…

NSScreencast Episode #123 STHTTPRequest

STHTTPRequest - NSScreencast STHTTPRequestの実装とそのテスト STHTTPRequest light weight network library itunes.apple.com/search api stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding [STHTTPRequest requestWithURLString uploadPr…

NSScreencast Episode #122 Animating with POP

Animating with POP - NSScreencast Spring(バネ)の効果をアニメーションに付加する framework pop animation facebook extracted out from Paper POPSpringAnimation anim.springBounciness = 20; anim.springSpeed = 1; POPDecayAnimation anim.decelerati…

NSScreencast Episode #121 Mantle with Core Data Part 2

Mantle with Core Data Part 2 - NSScreencast 取得したエピソード一覧を画面に表示 titleが更新された時画面が更新されない問題 NSFetchedResultsControllerDelegate didChangeObject atIndexPath forChangeType switch (type) NSFetchedResultsChangeInser…

NSScreencast Episode #120 Mantle with Core Data

Mantle with Core Data - NSScreencast NSScreencastsのエピソード情報を取得して一覧 Base - manage SQLite databases MTLManagedObjectAdapter if ([moc save:&saveError]) [self.persistenceController saveContextAndWait:YES completion: MTLManagedObj…

NSScreencast Episode #119 URL Scheme Callbacks

URL Scheme Callbacks - NSScreencast URL Schemeでcallbackを使って、遷移してすぐ戻る Info Url types Url Sheme Add url scheme x-callback-wordrev Sending NSURL URLWithString stringWithFormat:@"x-callback-wordrev://x-callback-url?x-source=Schem…

NSScreencast Episode #118 Integrating with 1Password

Integrating with 1Password - NSScreencast 1Passwordのアプリと連携 Riposte/RPSTPasswordManagementAppService · GitHub いろいろなバージョンの1Passwordに対応 agilebit Developers: Here’s how to add a little 1Password to your iOS apps (Update 2x…

NSScreencast Episode #117 URL Schemes

URL Schemes - NSScreencast URL schemeで遷移して、URL上のwordをreverseするアプリ 例 somestring://asdf , tel://123 build settings info url types - url scheme name collision can jump from mobile safari wordref://asdf application openURL sourc…

NSScreencast Episode #116 Mantle

Mantle - NSScreencast #import "Mantle.h" @interface Episode : MTLModel <MTLJSONSerializing> NSCoder NSValueTransformer episodeTypeJSONTransformer publishedAtJSONTransformer thumbnailImageUrlJSONTransformer [NSValueTransformer valueTransformerForName:MTLURLVal</mtljsonserializing>…

NSScreencast Episode #115 Submitting to the App Store

Submitting to the App Store - NSScreencast AppStoreに上げる app icon launch image ifdef debug fps ifdef screenshot appstore folder for memo bundle id current version new version description support url marketing url ready to upload binary …

NSScreencast Episode #114 Playing Sounds with Sprite Kit

Playing Sounds with Sprite Kit - NSScreencast 音声を再生する audio files Royalty Free Music - Sound Effects - Stock Audio | AudioJungle wav to convert smaller × mp3 iphone cannot decode simultaneously ima4 afconvert -f caff -d ima4 in.wav …

NSScreencast Episode #113 Giggletouch - Part 2

Giggletouch - Part 2 - NSScreencast Smileyの画像を使って、縮小や画面から消えるアニメーション giggle touch change last time shape bigger rotate slower arc4random_uniform arc4randomはbiasがある (modular random) MAX_NUMが2の累乗であれば完全に…

NSScreencast Episode #112 Giggletouch

Giggletouch - NSScreencast タッチすると図形と赤ん坊の声が出るアプリの更新 old app iOS 5 Sprite Kit XCodeでSprite Kitゲームテンプレート 初心者の為のSprite Kit チュートリアル | Ray Wenderlich 座標の原点が左下(左上ではない) GTViewController…

NSScreencast Episode #111 Xcode 5.1

Xcode 5.1 - NSScreencast XCode5.1の解説 NSLogとdescriptionメソッドのオーバーライド debugQuickLookObjectで図などのオブジェクトがプレビューできる XCodeの下のペインの目のアイコン breakpoint時に変数を選択して目のアイコンで UIBezierPath 図形描…

NSScreencast Episode #110 Swipe to Reveal Redux

Swipe to Reveal Redux - NSScreencast セルをスワイプしてactionする機能で 以前のやつで問題を指摘されたのでその解決 challenging scroll view eating touches subclass of UIScrollView BSTapScrollView.h @optional scrollView touchesBegan scrollView…

NSScreencast Episode #109 MDMCoreData

MDMCoreData - NSScreencast 体重のデータをCoreDataに登録、表示 pod 'MDMCoreData', '~> 1.0' MDMPersistenceController.m [self.managedObjectContext setParentContext:self.writerObjectContext]; storeUrl = [NSURL fileURLWithPath:[[self documentsD…

NSScreencast Episode #108 Unwinding Segues

Unwinding Segues - NSScreencast unwind segueを使って画面を戻す unwindFromRecordWeight:(UIStoryboardSegue *)segue unwindFromLog:(UIStoryboardSegue *)segue drag back button to Exit of VC drag yellow icon(the most left) to Exit save _didSave …

NSScreencast Episode #107 Swipe to Reveal Cells

Swipe to Reveal Cells - NSScreencast 左スワイプして2種類のアクションを表示する Reveal $89 Reveal App cell - contentView - scrollView - view storyboard set same value of x, y(0, 0) and width, height to all views set autolayout 4 margins and…

NSScreencast Episode #106 UITableViewCell Swipe Action

UITableViewCell Swipe Action - NSScreencast TableViewでMark as readのマークをスワイプでトグルする SwipeCell layoutSubviews _scrollView = [[UIScrollView alloc] initWithFrame:self.contentView.bounds]; [self.contentView insertSubview:_scrollV…

NSScreencast Episode #105 Strong versus Copy

Strong versus Copy - NSScreencast propertyのstrongとcopyの違い @property (nonatomic, copy) NSString *name; にすべき mutable NSMutableString NSMutableArray [name replaceCharactersInRange:NSMakeRange(0, 1) withString:@"A"]; 間違えるとおかし…

NSScreencast Episode #104 Blur

Blur - NSScreencast 画面下から出るビューにぼかし効果を加える Blur 50% alpha see through スライドするパネルの背景画像の固定など createPanel #if USE_TOOLBAR_METHOD [[UIToolbar alloc] initWithFrame:self.panel.bounds]; blurToolbar.barStyle = U…

NSScreencast Episode #103 Refactoring View Controllers - Part 2

Refactoring View Controllers - Part 2 - NSScreencast Twitterのフォロワーを一覧するアプリのリファクタリング続き refactoring -> simple view did load introduce concept of model TwitterFollower.m initWithDictionary map operation create new gro…

NSScreencast Episode #102 Refactoring View Controllers

Refactoring View Controllers - NSScreencast Twitterのフォロワーを一覧するアプリのリファクタリング #import <Social/Social.h> viewDidLoad has small lines of code eventually refactoring extract to new class extract with new method (completion block etc.) Add </social/social.h>…

NSScreencast Episode #101 NSPredicate

NSPredicate - NSScreencast csv NSString *contents = [NSString stringWithContentsOfFile:csvPath encoding:NSUTF8StringEncoding error:nil]; NSArray *lines = [contents componentsSeparatedByString:@"\r\n"]; [lines enumerateObjectsUsingBlock:^(N…

NSScreencast Episode #100 Particle Systems

Particle Systems - NSScreencast 火の玉みたいなアニメーション CAEmitterLayer emitterShape = kCAEmitterLayerPoint; Point/Line/Rectangle/Cuboid/Circle/Sphere emitterPosition renderMode kCAEmitterLayer Unordered, OldestFirst, OldestLast, BackT…