Skip to content

Instantly share code, notes, and snippets.

actor User
participant App
collections Photos
database CoreData
User -> App: Open Photo Picker View
App -> Photos: Fetch photos from the Photos app
App <- Photos
User <- App: Show fetched photos
User -> App: Select photos and share to an album
@rockname
rockname / update_carthage_libraries.rb
Created February 20, 2019 11:04
CarthageのライブラリをアップデートしてPullRequestを作成するFastlaneのlane
lane :update_carthage_libraries do |options|
outdateds = ""
Dir.chdir ".." do
outdateds += sh("carthage", "outdated")
end
current_branch = git_branch
outdateds.each_line do |line|
class GeneralizedDataSource: StructuredTableCellDataSource {
func load(_ tasks: [Task]) {
let profileSection = TableCellSection(rows: [TableCellRow(reusableId: "ProfileTableViewCell", value: ())])
let personalTaskSection = TableCellSection(
rows: tasks.filter { $0.category == .personal }.map { TableCellRow(reusableId: "TaskTableViewCell", value: $0) },
headerTitle: Category.personal.rawValue
)
let shoppingTaskSection = TableCellSection(
rows: tasks.filter { $0.category == .shopping }.map { TableCellRow(reusableId: "TaskTableViewCell", value: $0) },
func configureCell(_ cell: UITableViewCell, withValue value: Any) {}
.
.
.
final func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let row = self.sections[indexPath.section].rows[indexPath.row]
let cell = tableView.dequeueReusableCell(withIdentifier: row.reusableId, for: indexPath)
self.configureCell(cell, withValue: row.value) //
return cell
}
final func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return sections[section].headerTitle
}
final func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.sections[section].rows.count
}
final func numberOfSections(in tableView: UITableView) -> Int {
return self.sections.count
}
class StructuredTableCellDataSource: NSObject, UITableViewDataSource {
private var sections: [TableCellSection] = []
.
.
.
struct TableCellRow {
let reusableId: String
let value: Any
}
struct TableCellSection {
var rows: [TableCellRow]
let headerTitle: String?
let footerTitle: String?
init(rows: [TableCellRow], headerTitle: String? = nil, footerTitle: String? = nil) {
self.rows = rows
self.headerTitle = headerTitle
self.footerTitle = footerTitle
}