我有这个原始的sql我想转换为Esqueleto。它应该通过group
表格将所有用户ID为1 group_membership
的用户身份注册到SELECT *
FROM group
LEFT OUTER JOIN group_membership
ON (group.id = group_membership.group_id AND group_membership.user_id=1)
WHERE group_membership.group_id IS NULL
。
// First view controller
@IBAction func unwindActivitiesVCCellTapped( segue: UIStoryboardSegue )
{
// table view cell tapped
guard let activitiesVC = segue.sourceViewController as? ActivitiesVC else { return }
print(activitiesVC.activityPerforming) // Displays nil in console output
if let activityPerforming = activitiesVC.activityPerforming // thus this does not get called
{
activityPerformingButton.titleLabel?.text = activityPerforming
}
}
// Second View Controller
class ActivitiesVC: UIViewController
{
@IBOutlet weak var activitiesTableView: UITableView!
let activityTitles = [ "Walk" , "Run ", "Cycle", "Mountain Bike" ]
var activityPerforming: String?
override func viewDidLoad()
{
super.viewDidLoad()
activitiesTableView.dataSource = self
activitiesTableView.delegate = self
}
}
extension ActivitiesVC: UITableViewDelegate
{
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
{
activityPerforming = activityTitles[ indexPath.row ]
print(activityPerfoming) // displays optional value I want
}
}
// Custom Cell
class ActivityCell: UITableViewCell
{
@IBOutlet weak var imageLabel : UILabel!
@IBOutlet weak var activityLabel : UILabel!
override func awakeFromNib()
{
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool)
{
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}