Timers聲明##
var timer:Timer?
在這里必須將timer聲明為可選類(lèi)型,否則會(huì)出現(xiàn)class viewcontroller has no initializers 錯(cuò)誤
Timer初始化并添加到RunLoop中##
timer = Timer.init(timeInterval: 0.1, target: self, selector:#selector(updateTimer), userInfo: nil, repeats: true)
RunLoop.main.add(timer!, forMode: .commonModes)
Timer從運(yùn)行循環(huán)中消除##
// 從運(yùn)行循環(huán)中移除
cycyleTimer?.invalidate()
cycyleTimer = nil
利用Timer的特點(diǎn)我簡(jiǎn)單做了一個(gè)定時(shí)器,地址
第二個(gè)部分就是Git基礎(chǔ)入門(mén),最簡(jiǎn)單的第一次將代碼上傳到github
step1:終端cd 進(jìn)入本地項(xiàng)目目錄
step2:git init
step3:git add .
step4:git commit -m "xxxxx" 至此git本地倉(cāng)庫(kù)創(chuàng)建完畢
step5:ssh -keygen -t rsa -C "xxxxx@xxxx.com"
step6:登錄github帳號(hào),進(jìn)入setting,選擇SSH and GPG keys,復(fù)制剛才生成的id_rsa.pub文件內(nèi)容到內(nèi)容框中
step7:在github上為你的項(xiàng)目創(chuàng)建profile,并且復(fù)制生成的網(wǎng)址
step7:cd 進(jìn)入本地項(xiàng)目目錄
step8:git remote add origin https://github.com/xxxx/xxxxx.git(剛才復(fù)制的網(wǎng)址)
step9:git push -u origin master 至此提交遠(yuǎn)程倉(cāng)庫(kù)結(jié)束。1分鐘后可以在Github 上看到自己提交的代碼
原文鏈接:http://www.lxweimin.com/p/edbd334e2ffa
當(dāng)然,針對(duì)上述作者所述的步驟,不必完全照搬,首先step4,step5,step6可以在之前就完成,step1,step2,step3可以在創(chuàng)建項(xiàng)目之初就完成,所以這完全取決于你自己。
GitHub確實(shí)是個(gè)好東西,希望自己能用好,Swift3也要慢慢學(xué)起來(lái)了。加油。