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
#import "Connection.h" | |
#import "Reachability.h" | |
@implementation Connection { | |
BOOL b; | |
} | |
-(BOOL) connectionStart { | |
Reachability *reachability = [Reachability reachabilityWithHostName:@"http://www.apple.com"]; |
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
// Min値とMax値を指定して乱数を生成 | |
func generateRandomNumber(var min min: Int, var max: Int) -> Int { | |
if min > max { | |
(min, max) = (max, min) | |
} | |
return Int(arc4random_uniform(UInt32(max + 1 - min)) + UInt32(min)) | |
} | |
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
/*: | |
# **First** Comment | |
* * * | |
*Second Comment* | |
***** | |
* Item 1 | |
* Item 2 | |
* Item 3 | |
1. Item 1 |
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
var color = UIColor.orangeColor() | |
var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0 | |
let b = color.getRed(&red, green: &green, blue: &blue, alpha: &alpha) | |
red //=> 1 | |
green //=> 0.5 | |
blue //=> 0 |
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
import UIKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var bottomLayout: NSLayoutConstraint! | |
let notificationCenter = NSNotificationCenter.defaultCenter() | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
import UIKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var bottomLayout: NSLayoutConstraint! | |
let notificationCenter = NSNotificationCenter.defaultCenter() | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
let array: [String] = [] | |
let array: Array<String> = [] | |
let array = [String]() | |
if array.count != 0 { | |
// 配列が存在する時の処理 | |
} |
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
// 現在のファイル名 | |
__FILE__ | |
//=> /Users/******/Desktop/Swift_Practice/Swift_Practice/ | |
// 現在の行数 | |
__LINE__ | |
// 現在のカラム数 | |
__COLUMN__ |
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
NSRunLoop.currentRunLoop().addTimer(timerObj, forMode: NSRunLoopCommonModes) | |