I want to make a repeat list like in the picture below for my alarm app in swift, I've tried my best but all my attempts have failed, how I can do it, how I can save multiple values in one attributes in database, do I need array, how i can do check list; my project is almost complete, the only thing left is repeat list which I failed to make it
thanks in advance
Reminder.swift
verride func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "presentDay" {
if let daysPickerVie
wController = segue.destinationViewController as? Days {
let path = tableView.indexPathForSelectedRow
detailLabel.text = daysPickerViewController.days[(path?.row)!]
}
}
}
Days.swift
class Days: UITableViewController
{
var lastSelectedIndexPath = NSIndexPath(forRow: -1, inSection: 0)
let days = [
"Everyday",
"Saturday",
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"]
var selectedDay:String?
var selectedDayIndex:Int?
var cell:UITableViewCell?
override func viewDidLoad() {
//navigationController?.navigationBar.topItem?.title = "Back"
}
extension Days{
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return days.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("daySelected", forIndexPath: indexPath) as UITableViewCell
cell.accessoryType = .None
cell.textLabel?.text = days[indexPath.row]
selectedDay = days[indexPath.row]
return cell
}
}
extension Days {
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if let cell = tableView.cellForRowAtIndexPath(indexPath) {
if cell.selected {
cell.accessoryType = .Checkmark
}
}
}
override func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
if let cell = tableView.cellForRowAtIndexPath(indexPath) {
cell.accessoryType = .None
}
}
}