This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BinarySearch.m | |
// KIObjcAlgorithms | |
// | |
// Created by Keita on 9/8/15. | |
// Copyright (c) 2015 Keita Ito. All rights reserved. | |
// | |
#import "BinarySearch.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SelectionSort.m | |
// KIObjcAlgorithms | |
// | |
// Created by Keita on 9/11/15. | |
// Copyright © 2015 Keita Ito. All rights reserved. | |
// | |
#import "SelectionSort.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Archvier<T: AnyObject> { | |
static func getStringOfClassName(object: T) -> String { | |
return String(T) | |
} | |
} | |
// NSStringFromClass() didn't work with my custom class, even it is a subclass of NSObject. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prepare address values. These values will be saved in a record in iPhone's address book. | |
NSString *city = @"Yokohama"; | |
NSString *state = @"Kanagawa" | |
NSString *country = @"Japan"; | |
// Get a record ID. | |
ABRecordID recordID = self.recordID; // Assume you have a recordID. | |
// Create dictionary for address. | |
ABMutableMultiValueRef address = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NSCoding Protocol conformed implementation | |
// Reference: http://stackoverflow.com/questions/20539619/storing-custom-objects-with-core-data | |
import Foundation | |
class MyClass: NSObject, NSCoding { | |
let name: String | |
init(name: String) { | |
self.name = name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
import XCPlayground | |
class SomeView: UIView { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
let button = UIButton(frame: self.bounds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
let tuples = [("A", "あ"), ("I", "い"), ("U", "う"), ("E", "え"), ("O", "お")] | |
print("With argument list") | |
tuples.forEach { (eng, jpn) in | |
print(eng) | |
print(jpn) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
******************** | |
Testing Time: 815.15s | |
******************** | |
Failing Tests (346): | |
Swift(macosx-x86_64) :: SILOptimizer/specialize_partial_apply.swift | |
Swift(macosx-x86_64) :: SILOptimizer/let_properties_opts_runtime.swift | |
Swift(macosx-x86_64) :: SILOptimizer/capture_propagation_linkage.swift | |
Swift(macosx-x86_64) :: stdlib/BridgeIdAsAny.swift.gyb | |
Swift(macosx-x86_64) :: multifile/error-type/two-modules/main.swift | |
Swift(macosx-x86_64) :: multifile/synthesized-accessors/one-module-public/main.swift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2016-12-25 01:39:56.726 RealmSantaTracker[68899:4488336] Sync: Opening Realm file: /Users/keitaito/Library/Developer/CoreSimulator/Devices/410BBEF4-54EF-412E-8C8C-ECE9CDE1C5AA/data/Containers/Data/Application/D1047B1A-5CFC-4029-AA1B-2EA45A64C563/Documents/realm-object-server/771b9ee46cf86cd5b6b28a77d3aa688e/realm%3A%2F%2F162.243.150.99%3A9080%2Fsanta | |
2016-12-25 01:39:56.728 RealmSantaTracker[68899:4488336] Sync: Connection[1]: Session[1]: Starting session for '/Users/keitaito/Library/Developer/CoreSimulator/Devices/410BBEF4-54EF-412E-8C8C-ECE9CDE1C5AA/data/Containers/Data/Application/D1047B1A-5CFC-4029-AA1B-2EA45A64C563/Documents/realm-object-server/771b9ee46cf86cd5b6b28a77d3aa688e/realm%3A%2F%2F162.243.150.99%3A9080%2Fsanta' | |
2016-12-25 01:39:56.729 RealmSantaTracker[68899:4488336] Sync: Connection[1]: Resolving '162.243.150.99:9080' | |
2016-12-25 01:39:56.733 RealmSantaTracker[68899:4488336] Sync: Connection[1]: Connecting to endpoint '162.243.150.99:9080' (1/1) | |
2016-12-25 01:39:56.752 RealmSantaTracker[68899:4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Updated to Swift 3 syntax. | |
func mapScalarValues(s: String, f: (UInt32) -> UInt32) -> String { | |
let scalars = Array(s.unicodeScalars) | |
let encrypted = scalars.map { x in | |
Character(UnicodeScalar(f(x.value))!) | |
} | |
return String(encrypted) | |
} |
OlderNewer