Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stock realm alert #200

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions Stepippo/Classes/Controllers/GoalSettingVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
//

import UIKit

/// タスクの目標を設定する画面
final class GoalSettingVC: UIViewController {

final class GoalSettingVC: UIViewController, RealmObjectAccessible {
var taskArray: [String] = []

// MARK: - IBOutlet properties
Expand All @@ -24,6 +22,23 @@ final class GoalSettingVC: UIViewController {
}

@IBAction func stockButton(_ sender: Any) {

if let addTaskText = addTaskTextField.text, !addTaskTextField.text!.isEmpty {
let ippo = IPPO()
ippo.title = addTaskText
ippo.status = .stock
write(ippo)
} else {
let alert: UIAlertController = UIAlertController(title: "アラート表示", message: "タスク名が空です", preferredStyle: UIAlertController.Style.alert)
let cancelAction: UIAlertAction = UIAlertAction(title: "タスク名を入力する", style: UIAlertAction.Style.cancel, handler:{
(action: UIAlertAction!) -> Void in
print("Cancel")
})
alert.addAction(cancelAction)
present(alert, animated: true, completion: nil)
}


}

@IBAction func addButton(_ sender: Any) {
Expand Down