Swift 3 遷移工作總結

2021-09-09 02:23:09 字數 2297 閱讀 5640

寫在前面

背景

**量(4萬行)

遷移時間(一天左右)

準備

在開發最初開發選擇 swift 的時候的很多決策也讓我這次少了很多任務作量。

介面用 xib 而不用純**

關於第三方庫的選擇:

得益於上面兩點,在遷移過程中少了不少工作量。?

知識儲備公升級

然後把語法文件快速的重溫了一遍。

中文版:

遷移中的問題

any && anyobject

這也就是為什麼在第一混編的專案中我花了那麼多時間去修改**了!得益於混編的第二個專案學習了 yep 的思路,是把 [string:anyobject] 命名為乙個叫做 jsondictionary 的型別。所以在 any && anyobect 這個事情上,就花了一點點時間。

// swift 2

var json = [string:anyobect]()

json["key1"] = 1

json["key2"] = "2"

// to swift 3 step 1

var json = [string:anyobect]()

json["key1"] = 1 as anyobject?

json["key2"] = "2" as anyobject?

// to swift 3 step 2

var json = [string:any]()

json["key1"] = 1

json["key2"] = "2"

// swift 2

public typealias jsondictionary = [string: anyobject]

// to swift 3 step 2

public typealias jsondictionary = [string: any]

alamofire 等三方庫支援 ios8

// 其實都是 !os(watchos) 這個巨集下面的

#if !os(watchos)

@discardableresult

public func stream(withhostname hostname: string, port: int) -> streamrequest

handler(pedometerdata, error)

// 做一些事情

// 最後逼不得已只能不修改了,函式外面就做一些事情了

pedonmeter.querypedometerdata(from: starttime, to: endtime, withhandler:  handler as! cmpedometerhandler)

result of call to 『funtion』 is unused

date && nsdate

caanimationdelegate

@inte***ce nsobject (caanimationdelegate)

- (void)animationdidstart:(caanimation *)anim;

- (void)animationdidstop:(caanimation *)anim finished:(bool)flag;

@end

@protocol caanimationdelegate

@optional

- (void)animationdidstart:(caanimation *)anim;

- (void)animationdidstop:(caanimation *)anim finished:(bool)flag;

@end

因為寬度時間比較長,其他的暫時想不到了。未完待續吧…

其他

還有幾個不錯的總結

總結

更多

工作之餘,寫了點筆記,如果需要可以在我的 github 看。

Swift 3 遷移工作總結

swift 3.0 正式版發布了差不多快乙個月了,斷斷續續的把手上和 swift 相關的遷移到了swift 3.0。所以寫點小總結。在開發最初開發選擇 swift 的時候的很多決策也讓我這次少了很多任務作量。陰差陽錯的,和 swift 相關的大部分介面都是用xib 畫的。而這個 xib 在這次遷移中...

工作總結3

第一部分 對上 1 關於犯錯 作為乙個領導的話,一般是只關注結果的,會有一定的包容度,但是整體第一次犯錯是正常,第二次犯錯就是減分,第三次犯錯基本就要動搖是否重視你了,幾乎短時間就不會重視了,嚴重了甚至更勝 2 關於風格 喜歡主動思考進取 聽話奉承 務實聽取建議 真誠3 階段適應 對不同情況有他們自...

Swift3遷移至Swift4可能遇到的問題小結

前言 wwdc 2017 帶來了很多驚喜。swift 4 也伴隨著 xcode 9 測試版來到了我們的面前,很多強大的新特性非常值得我們期待在正式專案中去使用它。本文將給大家詳細介紹關於swift3遷移至swift4遇到的問題,下面話不多說了,來一起看程式設計客棧看詳細的介紹吧 問題如下 1.the...