Swift4 Day74:做一個待辦事項Todoey4
Swift4 / iOS11 / 2017.01.12–01.29 Chameleon、SwipeCellKit應用
Todoey完整程式碼
寒假開始了,旅遊也結束了,回來開始coding吧!
今天做事的時候都有開著toggl計時,寫code4小時medium1.5小,還打了爐石哈哈,實際的時間真的跟身體感覺差很多,轉眼就快12點啦😂
SwipeCellKit 2.0.1
- cd 到資料夾; open Podfile -a Xcode
- 在Xcode中pod ‘SwipeCellKit’ (如果很多error用
pod ‘SwipeCellKit’, :git => ‘https://github.com/SwipeCellKit/SwipeCellKit.git', :branch => ‘develop’) - pod install
- import SwipeCellKit
- ..省略很多步驟,詳細可以看github中的文件喔
CategoryViewController跟TodoListViewController用SwipeTableViewController應用的完整程式碼:在這
建立一個SwipeTableViewController然後用override的方式去理解subclass
到CategoryViewController跟TodoListViewController上的Cell
將custom class的class跟module改成上述Swipe
identifier改成Cell,配合SwipeTableViewController中設定的Cell
到CategoryViewController跟TodoListViewController
1.TodoListViewController: SwipeTableViewController
2.cellForRowAt一樣用override讓CategoryViewController跟TodoListViewController分別,像CategoryViewController就是用 “No Categories Added Yet”
3.override一些SwipeTableViewController無法設定的各自屬性,在SwipeTableViewController中無法拿到CategoryViewController跟TodoListViewController的資料,所以用這種方式傳遞資料,再用realm刪除
Chameleon
Lighter and Darker Colors
version1:顏色會都相同CGFloat(indexPath.row/todoItems!.count)
version2:有漸層CGFloat(indexPath.row)/CGFloat(todoItems!.count)