http://www.muukii.me/blog/daily/815
こういう見えないクラスとの一致をSwiftでやる方法。
if "_UINavigationBarBackground" == NSStringFromClass(view.dynamicType) {
dynamicType & NSStringFromClass で文字列比較。。。
| NSLog("0. start") | |
| self.request1() | |
| .success { _ -> Task<Progress, Int, Bool> in | |
| NSLog("1-2. request1 callback") | |
| return self.request2() | |
| } | |
| .success { _ in | |
| NSLog("2-2. request2 callback") | |
| } |
| ``` | |
| println("#### abbreviation, \(timeZone.abbreviation)") | |
| println("#### name, \(timeZone.name)") | |
| println("#### description, \(timeZone.description)") | |
| let en = NSLocale(localeIdentifier: "en_US") | |
| println("#### Standard, \(timeZone.localizedName(.Standard, locale: en))") | |
| println("#### ShortStandard, \(timeZone.localizedName(.ShortStandard, locale: en))") | |
| println("#### DaylightSaving, \(timeZone.localizedName(.DaylightSaving, locale: en))") | |
| println("#### ShortDaylightSaving, \(timeZone.localizedName(.ShortDaylightSaving, locale: en))") |
| // 最適化によりnilが返っちゃうfunction | |
| func parseFacebookUserDictionary(dictionary: NSDictionary) -> FacebookUserInformation? { | |
| if let dict = dictionary as? [String : AnyObject] { | |
| let information = FacebookUserInformation(dictionary: dict) | |
| return information | |
| } | |
| return nil | |
| } | |
| // nilが返らないfunction |
http://www.muukii.me/blog/daily/815
こういう見えないクラスとの一致をSwiftでやる方法。
if "_UINavigationBarBackground" == NSStringFromClass(view.dynamicType) {
dynamicType & NSStringFromClass で文字列比較。。。
| infix operator <<= { | |
| associativity right | |
| precedence 90 | |
| assignment | |
| } | |
| infix operator %= { | |
| associativity right | |
| precedence 90 | |
| assignment |
| dict = { | |
| ColorModel = RGB; | |
| DPIHeight = 72; | |
| DPIWidth = 72; | |
| Depth = 8; | |
| Orientation = 1; | |
| PixelHeight = 2448; | |
| PixelWidth = 3264; | |
| "{Exif}" = { | |
| ApertureValue = "2.275007124536905"; |
| # autojump | |
| function autojump-peco() { | |
| local cd_history_path="~/.local/share/autojump/autojump.txt" | |
| local SELECTED=$(eval more $cd_history_path | peco | cut -f2) | |
| if [ 0 -ne ${#SELECTED} ]; then | |
| eval echo "cd $SELECTED" | |
| eval cd $SELECTED | |
| fi | |
| } | |
| zle -N autojump-peco |
| tmux capture-pane -t 0 -S -32768; tmux show-buffer | vim - -c 32768 |
| if [ ${CONFIGURATION} = "Debug" ]; then | |
| plistBuddy="/usr/libexec/PlistBuddy" | |
| infoPlist=${TEMP_DIR}"/Preprocessed-Info.plist" | |
| marketVersion=$($plistBuddy -c "Print CFBundleShortVersionString" $infoPlist) | |
| versionPrefix="dev-" | |
| lastCommitDate=`xcrun git log -1 --format='%ci'` | |
| versionSuffix=" ($lastCommitDate)" |
| marketVersion=`xcrun agvtool what-marketing-version | grep "^Found " | head -1 | gsed -e "s/.*\"\([.0-9]\+\)\".*/\1/"` | |
| if [ ${CONFIGURATION} = "Release" ]; then | |
| versionString="\"$marketVersion\"" | |
| else | |
| lastCommitDate=`xcrun git log -1 --format='%ci'` | |
| versionString="\"$marketVersion ($lastCommitDate)\"" | |
| fi | |
| xcrun agvtool new-version "$versionString" |