Skip to content

Instantly share code, notes, and snippets.

@satoshin2071
satoshin2071 / error_swift.md
Last active February 5, 2016 03:14
swift エラー系

do try catch

doでスコープ作成 throwsがつけて定義されたメソッドはtryで呼び出す。 catchで例外発生したときの処理を記述

サンプル

let manager = NSFileManager.defaultManager()
do {
	let contents = try manager.contentsOfDirectoryAtPath(path)
@satoshin2071
satoshin2071 / file0.swift
Last active March 1, 2016 08:38
UIStoryboardからUIViewController取得する過程で間違ったStoryboard名を渡して落とさないためのUIViewControllerExtension ref: http://qiita.com/satoshin2071/items/14b75a231b1207b7575f ↓ R.swift使うとか https://github.com/mac-cain13/R.swift
import UIKit
extension UIViewController {
public class func safetyDestinationViewController(storyboardName: String) -> UIViewController? {
guard let _ = NSBundle.mainBundle().pathForResource(storyboardName, ofType: "storyboardc") else{
return nil
}
@satoshin2071
satoshin2071 / file0.swift
Last active February 2, 2016 02:43
ProtocolExtensionを利用して画面遷移拡張プロトコルの基底処理を実装してみたサンプル ref: http://qiita.com/satoshin2071/items/e3e122f354188950eeca
protocol RoutingProtocol{
typealias Param = AnyObject
/**
pushViewcontroller with any argument
- parameter viewController: conform to RoutingProtocol
- parameter params: any argument
@satoshin2071
satoshin2071 / file0.m
Created January 14, 2016 08:40
UILabelとUITextViewで、textAlignment設定時における文末の半角/全角スペースの扱いについて ref: http://qiita.com/satoshin2071/items/7fbe41dbee8abbe85f5c
// 文末半角
NSAttributedString *noBreakSpaceTxt = [[NSAttributedString alloc]initWithString:@"UILabel.NoBreakSpaceX5 "];
// 文末全角
NSAttributedString *ideoGraohicSpaceTxt = [[NSAttributedString alloc]initWithString:@"UILabel.IdeoGraohicSpaceX3   "];
NSArray *alignments = @[@(NSTextAlignmentLeft),@(NSTextAlignmentCenter),@(NSTextAlignmentRight),@(NSTextAlignmentLeft),@(NSTextAlignmentCenter),@(NSTextAlignmentRight)];
// 確認用表示
@satoshin2071
satoshin2071 / UIViewController+Detect.m
Last active December 1, 2015 07:06
detect iPhone 5.5inch (required iOS 8.0)
#import "UIViewController+Detect.h"
@implementation UIViewController (Detect)
- (BOOL)is5_5
{
UITraitCollection *traintCollection = [self traitCollection];
return (traintCollection.verticalSizeClass == UIUserInterfaceSizeClassRegular &&
traintCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact &&
traintCollection.displayScale >= 3 &&
@satoshin2071
satoshin2071 / RoundRectView.swift
Last active October 15, 2015 06:07
IBDesignable & IBInspectable
//
// RoundRectButton.swift
// IBDesignableSample
//
// Created by ssato on 2015/10/15.
// Copyright (c) 2015年 ssato. All rights reserved.
//
import UIKit
@satoshin2071
satoshin2071 / convert.rb
Last active August 29, 2015 14:27
8/9 Civic Hack Day 保育園施設=>URL スクレイピング用 ※nokogiri使わないでSeleniumつかえば規約引っかからないかも??
#!/usr/bin/ruby
# -*- encoding: utf-8 -*-
require "rubygems"
require "nokogiri"
require "open-uri"
require "cgi"
require 'csv'
require 'nkf'
###TODO:http://ipv4.google.com/sorry/IndexRedirect
@satoshin2071
satoshin2071 / new_gist_file_0
Created July 23, 2015 12:21
Asset Catalog の Launch Image を参照する
archiveしてipa書き出し
作成したipaファイルの拡張子を.zipに
解凍
Payload フォルダ の パッケージの内容を表示
LaunchImage-700-568h@2x.png
LaunchImage-700@2x.png
@satoshin2071
satoshin2071 / gist:b57f103c0ecb50668e53
Created April 15, 2015 11:05
NSString + removedJapString
@interface NSString (RemoveJap)
- (NSString*)removedJapString ;
@end
@implementation NSString (RemoveJap)
- (NSString*)removedJapString {

uGUIの応用と拡張 ~uGUIをさらに使いこなすには~

##ざっくりと 「UnityゲームUI実践ガイド」の著者二人が送るUnityでUIで演出するときのいろは

##スライド http://uiunity.com/unite2015.html

##動画