It's my first time creating an app with Xcode, and I have come across an error I can't figure out. The fatal error:
Thread 1: Fatal error: Unexpectedly found nil while implicitly
unwrapping an Optional value, occurs on line 29.
I've seen other posts with comments saying "check your outlets", but they're all good. I've included the Connections inspector of one of my textfields in case it helps.
import UIKit
class ViewController: UIViewController, UITextFieldDelegate {
var mssgArray:[Int] = [0,0,0,0,0,0,0,0]
#IBOutlet weak var ItemQ: UITextView!
#IBOutlet weak var RTC: UITextView!
#IBOutlet weak var ExpoPrompt: UITextView!
#IBOutlet weak var OrderPrompt: UITextView!
#IBOutlet weak var Data: UITextView!
#IBOutlet weak var CusID: UITextField!
#IBOutlet weak var FirstN: UITextField!
#IBOutlet weak var LastN: UITextField!
#IBOutlet weak var PhoneNum: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
CusID.delegate = self
FirstN.delegate = self
LastN.delegate = self
PhoneNum.delegate = self
}
#IBAction func PizzaBut(_ sender: UIButton) {
if(mssgArray[0] == 0)
{
ItemQ.text += "Pizza\n"
mssgArray[0] = 1
}
if(mssgArray[0] == 1)
{
mssgArray[0] = 2
}
}
#IBAction func SubBut(_ sender: UIButton) {
if(mssgArray[1] == 0)
{
ItemQ.text += "Sub\n"
mssgArray[1] = 1
}
if(mssgArray[1] == 1)
{
mssgArray[1] = 2
}
}
#IBAction func QuesoBut(_ sender: UIButton) {
if(mssgArray[2] == 0)
{
ItemQ.text += "Queso\n"
mssgArray[2] = 1
}
if(mssgArray[2] == 1)
{
mssgArray[2] = 2
}
}
#IBAction func BagBut(_ sender: UIButton) {
if(mssgArray[3] == 0)
{
ItemQ.text += "Baguette\n"
mssgArray[3] = 1
}
if(mssgArray[3] == 1)
{
mssgArray[3] = 2
}
}
#IBAction func PretzelBut(_ sender: UIButton) {
if(mssgArray[4] == 0)
{
ItemQ.text += "Pretzels\n"
mssgArray[4] = 1
}
}
#IBAction func MeatballBut(_ sender: UIButton) {
if(mssgArray[5] == 0)
{
ItemQ.text += "Meatball\n"
mssgArray[5] = 1
}
if(mssgArray[5] == 1)
{
mssgArray[5] = 2
}
}
#IBAction func BoardBut(_ sender: UIButton) {
if(mssgArray[6] == 0)
{
ItemQ.text += "Charcuterie Board\n"
mssgArray[0] = 1
}
if(mssgArray[6] == 1)
{
mssgArray[6] = 2
}
}
#IBAction func SaladBut(_ sender: UIButton) {
if(mssgArray[7] == 0)
{
ItemQ.text += "Salad\n"
mssgArray[7] = 1
}
if(mssgArray[7] == 1)
{
mssgArray[7] = 2
}
}
#IBAction func ClearBut(_ sender: UIButton) {
ItemQ.text = ""
mssgArray = [0,0,0,0,0,0,0,0]
}
#IBAction func SendMssg(_ sender: UIButton) {
ItemQ.text = ""
mssgArray = [0,0,0,0,0,0,0,0]
}
#IBAction func AddCus(_ sender: UIButton) {
}
#IBAction func SearchCus(_ sender: UIButton) {
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
func textFieldDidBeginEditing(_ textField: UITextField) {
if(textField == CusID || textField == PhoneNum)
{
textField.keyboardType = UIKeyboardType.phonePad
}
}
}
And here is a screenshot of the two tab views and what I'm seeing, the right tab is showing the tab bar controller's controller inspector.
Related
the problem is that I have currency flags and currency codes which are used in both of my screens. one is the first screen showing selected currency and the related flag and in the other screen i have same flags and codes next to each other inside tableview. Whichever i click on tableview i get it in the first screen as selected flag and code. what i want is I want to write a description next to the code like "{emoji} - USD - American Dollars" in the tableview but when i click it i dont want to see the American Dollars explanation in the first screen. how can i do that? this is what I want as a result and below that I m adding my codes
The Result I want
First VC
import UIKit
class ViewController: UIViewController {
#IBOutlet weak var amountText: UITextField!
#IBOutlet weak var amountText2: UITextField!
#IBOutlet weak var fromLabel: UILabel!
#IBOutlet weak var fromImage: UIImageView!
#IBOutlet weak var toImage: UIImageView!
#IBOutlet weak var toLabel: UILabel!
var currencyManager = CurrencyManager()
var from: String = "EUR"
var to: String = "TRY"
var amount: String = "0"
override func viewDidLoad() {
super.viewDidLoad()
amountText.delegate = self
currencyManager.delegate = self
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let currencySelectorViewController = segue.destination as? CurrencySelectorViewController {
if let sender = sender as? Int {
if sender == 1 {
currencySelectorViewController.fromCurrencySelection = self
} else {
currencySelectorViewController.toCurrencySelection = self
}
}
}
}
#IBAction func amountChanged(_ sender: UITextField) {
amount = sender.text!
//amountText.endEditing(true)
currencyManager.fetchRates(from: from, to: to, amount: amount )
}
//#IBAction func editingChanged2(_ sender: UITextField) {
// amount = sender.text!
//
// //amountText.endEditing(true)
// currencyManager.fetchRates(from: to, to: from, amount: amount )
// }
#IBAction func didTapView(_ sender: UITapGestureRecognizer) {
performSegue(withIdentifier: "currencySelector", sender: 1)
}
#IBAction func didTapView2(_ sender: UITapGestureRecognizer) {
performSegue(withIdentifier: "currencySelector", sender: 2)
}
}
extension ViewController: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
amountText.endEditing(true)
currencyManager.fetchRates(from: from, to: to, amount: amount )
return true
}
func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
if textField.text != "" {
return true
} else {
amountText.placeholder = "Enter an amount"
return false
}
}
func textFieldDidEndEditing(_ textField: UITextField) {
//amount = amountText.text!
//amount = amountText2.text!
amountText.text = ""
//amountText2.text = ""
}
}
extension ViewController: CurrencyManagerDelegate {
func didFailWithError(error: Error) {
print(error)
}
func didUpdateCurrency(_ currencyManager: String) {
DispatchQueue.main.async {
self.amountText2.text = currencyManager
}
}
}
extension ViewController: FromCurrencySelectorDelegate, ToCurrencySelectorDelegate {
func didGetCurrencyCode(from: String) {
fromLabel.text = from
self.from = from
}
func didGetCurrencyCode(to: String) {
toLabel.text = to
self.to = to
}
}
Second VC
import UIKit
protocol FromCurrencySelectorDelegate: AnyObject {
func didGetCurrencyCode(from: String)
}
protocol ToCurrencySelectorDelegate: AnyObject {
func didGetCurrencyCode(to: String)
}
class CurrencySelectorViewController: UIViewController {
weak var fromCurrencySelection: FromCurrencySelectorDelegate!
weak var toCurrencySelection: ToCurrencySelectorDelegate!
let reusableCell = "ReusableCell"
let currencyArray = ["🇪🇺 EUR", "\u{1F1FA}\u{1F1F8} USD", "\u{1F1F9}\u{1F1F7} TRY", "\u{1F1EC}\u{1F1E7} GBP", "\u{1F1EF}\u{1F1F5} JPY", "\u{1F1E8}\u{1F1E6} CAD", "\u{1F1E6}\u{1F1FA} AUD", "\u{1F1E7}\u{1F1EC} BGN", "\u{1F1F7}\u{1F1FA} RUB", "\u{1F1F3}\u{1F1F4} NOK", "\u{1F1E8}\u{1F1F3} CNY", "\u{1F1E8}\u{1F1ED} CHF", "\u{1F1F2}\u{1F1FD} MXN"]
var filteredData: [String]!
#IBOutlet weak var tableView: UITableView!
#IBOutlet weak var searchBar: UISearchBar!
override func viewDidLoad() {
super.viewDidLoad()
filteredData = currencyArray
searchBar.delegate = self
tableView.delegate = self
tableView.dataSource = self
}
}
extension CurrencySelectorViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return filteredData.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: reusableCell, for: indexPath)
cell.textLabel?.text = filteredData[indexPath.row]
return cell
}
}
extension CurrencySelectorViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if fromCurrencySelection != nil {
fromCurrencySelection.didGetCurrencyCode(from: currencyArray[indexPath.row])
} else {
toCurrencySelection.didGetCurrencyCode(to: currencyArray[indexPath.row])
}
dismiss(animated: true, completion: nil)
}
}
//MARK: - Search Bar Methods
extension CurrencySelectorViewController: UISearchBarDelegate {
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
filteredData = []
if searchText == "" {
filteredData = currencyArray
}
for word in currencyArray {
if word.uppercased().contains(searchText.uppercased()) {
filteredData.append(word)
}
}
self.tableView.reloadData()
}
}
I want my save button to show only when the user edits his username/email. I set the save button's alpha at 0 so if the user edits something, the button's alpha will be 1 and that's the only time he can save his details. For some reason, I can't make it work like how I want to.
Here's my code:
import UIKit
import Parse
class SettingsTableViewController: UITableViewController, UITextFieldDelegate {
#IBOutlet var currentUsername: UITextField!
#IBOutlet var currentEmail: UITextField!
#IBOutlet var saveButton: UIButton!
let currentUser = PFUser.current()
override func viewDidLoad() {
super.viewDidLoad()
currentUsername.text = currentUser?.username
currentEmail.text = currentUser?.email
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
saveButton.alpha = 1
return true
}
#IBAction func saveButtonPressed(_ sender: Any) {
if currentUsername.text != currentUser?.username {
currentUser?.saveInBackground()
}
}
#IBAction func signoutButtonPressed(_ sender: Any) {
PFUser.logOut()
performSegue(withIdentifier: "userSignedOut", sender: self)
}
}
Thanks in advance!
You can use add target for textfield when editing changed.
Here is the code you can use in your class.
override func viewDidLoad() {
super.viewDidLoad()
currentUsername.addTarget(self, action: #selector(self.textFieldDidChange(_:)), for: .editingChanged)
currentEmail.addTarget(self, action: #selector(self.textFieldDidChange(_:)), for: .editingChanged)
}
func textFieldDidChange(_ textField: UITextField) {
saveButton.alpha = currentUsername.text?.characters.count != 0 && currentEmail.text?.characters.count != 0 ? 1 : 0
}
I will prefer you to hide/unhide button rather than changing alpha
func textFieldDidChange(_ textField: UITextField) {
saveButton.isHidden = currentUsername.text?.characters.count == 0 || currentEmail.text?.characters.count == 0
}
please try this
override func viewDidLoad() {
super.viewDidLoad()
currentUsername.text = currentUser?.username
currentEmail.text = currentUser?.email
saveButton.isHidden = true
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
saveButton.isHidden = false
return true
}
#IBAction func saveButtonPressed(_ sender: Any) {
if currentUsername.text != currentUser?.username {
currentUser?.saveInBackground()
saveButton.isHidden = true
}
}
I have 2 text labels on one view controller and I want to connect the text from the labels to the corresponding UIButtons and UILabels on another View Controller.
Right now when I press on the "thisUploadPhoto" button it loads 2 screens of the next screen, instead of just one screen. If you could help me with that it would be great. Also, when I press the done and cancel buttons on the PhotoLabelViewController it gives me this error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[tot.PhotoShareLabelViewController didTapDone:]: unrecognized selector sent to instance 0x7f8cecf5d0b0'
When it is supposed to print 'done'
I don't know why my code below isn't working on connecting the 2 view controllers together.
import UIKit
class PhotoShareViewController: UIViewController {
#IBOutlet weak var imageView: UIImageView!
#IBOutlet weak var contentTextView: UITextView!
#IBOutlet weak var thatTextField: UITextField!
#IBOutlet weak var thisTextField: UITextField!
var presenter: PhotoShareModuleInterface!
var image: UIImage!
#IBAction func thisUploadPhoto(_ sender: Any) {
if thisTextField.text != "" && thatTextField.text != ""
{
performSegue(withIdentifier: "segue", sender: self)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
var photoShareLabelViewController = segue.destination as! PhotoShareLabelViewController
photoShareLabelViewController.thisString = thisTextField.text!
photoShareLabelViewController.thatString = thatTextField.text!
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
imageView.image = image
}
override var prefersStatusBarHidden: Bool {
return true
}
#IBAction func didTapCancel(_ sender: AnyObject) {
presenter.cancel()
presenter.pop()
}
#IBAction func didTapDone(_ sender: AnyObject) {
guard let message = thatTextField.text, !message.isEmpty else {
return
}
guard let messageOne = thisTextField.text, !messageOne.isEmpty else {
return
}
presenter.finish(with: image, content:message)
presenter.dismiss()
}
}
extension PhotoShareViewController: PhotoShareViewInterface {
var controller: UIViewController? {
return self
}
}
import UIKit
class PhotoShareLabelViewController: UIViewController {
#IBOutlet weak var thisLabel: UILabel!
#IBOutlet weak var thatLabel: UILabel!
#IBOutlet weak var thisButton: UIButton!
#IBOutlet weak var thatButton: UIButton!
var thisCounter = 0
var thatCounter = 0
var presenter: PhotoShareModuleInterface!
var image: UIImage!
#IBAction func pressedThisButton(_ sender: Any) {
thisCounter += 1
print(thisCounter)
}
#IBAction func pressedThatButton(_ sender: Any) {
thatCounter += 1
print(thatCounter)
}
var thisString = String()
var thatString = String()
#IBAction func pressedButtonDone(_ sender: Any) {
print("done")
}
#IBAction func pressedButtonCancel(_ sender: Any) {
print("cancel")
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
thisLabel.text = thisString
thisButton.setTitle(thisString, for: UIControlState.normal)
thatLabel.text = thatString
thatButton.setTitle(thatString, for: UIControlState.normal)
}
}
The "Done" button is wired from Storyboard to call a method called didTapDone in PhotoShareLabelViewController. However, your didTapDone method is implemented in PhotoShareViewController. It's a different view controller.
To fix this, put the method implementation in the correct view controller. Then, select your "Done" button in the Storyboard and go to its "Connections Inspector" [see image below] and remove its current wrong connection. Then, wire it to the correct didTapDone method in the correct view controller.
how to change index of segmentController in swift. i want when button is clicked the value of segment index should be changed
func respondToGesture(sender: UIGestureRecognizer)
{
if let swipeGesture = sender as? UISwipeGestureRecognizer
{
if swipeGesture.direction == UISwipeGestureRecognizerDirection.Right
{
// change the segment to previous
}
else
{
// change th esegment to next
}
}
}
Here is the way you can set selected index for segment:
import UIKit
import AVFoundation
class ViewController: UIViewController {
//outlet of your segment
#IBOutlet weak var segment: UISegmentedControl!
override func viewDidLoad() {
super.viewDidLoad()
}
#IBAction func setOne(sender: AnyObject) {
//set selected index to 0
segment.selectedSegmentIndex = 0
}
#IBAction func setTwo(sender: AnyObject) {
//set selected index to 1
segment.selectedSegmentIndex = 1
}
#IBAction func setThree(sender: AnyObject) {
//set selected index to 2
segment.selectedSegmentIndex = 2
}
#IBAction func four(sender: AnyObject) {
//set selected index to 3
segment.selectedSegmentIndex = 3
}
}
And result will be:
Hope it helps.
You can do like this:
#IBOutlet weak var mySegmentControl: UISegmentedControl!
var current = 0 // For current selection
#IBAction func buttonPressed(sender: AnyObject) {
if current == 0 {
mySegmentControl.selectedSegmentIndex = 1
current = 1
} else {
mySegmentControl.selectedSegmentIndex = 0
current = 0
}
I have two view Controllers connected with a tabBar. In the first tab, I see all buttons to add Repairs and Delete Repairs. In The First Step of my private project, I have Static values for the Repair times. Now in my second step, I wanted to change the time that a person needs to repair by the second tap, but when I go back after editing the time in the second VieController, the value of the struct didn't change.
ViewController.swift
class ViewController: UIViewController {
#IBOutlet weak var AddBrepair: UIButton!
#IBOutlet weak var AddOrepair: UIButton!
#IBOutlet weak var AddDrepair: UIButton!
#IBOutlet weak var GeniusNumber: UISegmentedControl!
#IBOutlet weak var AddBCrepair: UIButton!
#IBOutlet weak var CheckOutOrepair: UIButton!
#IBOutlet weak var CheckOutBrepair: UIButton!
#IBOutlet weak var CheckOutBCrepair: UIButton!
#IBOutlet weak var CheckOutDrepair: UIButton!
#IBOutlet weak var DisplayLeftNumber: UILabel!
#IBOutlet weak var RFPTime: UILabel!
#IBOutlet weak var CurrentTimerepair: UILabel!
let repairTime=RepairTime()
override func viewDidLoad() {
super.viewDidLoad()
//RFPTime.text = repairTime.ReadyForPickup()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
//print(repairTime.getNumberOfRepairGenius())
}
#IBAction func Controller(sender: AnyObject) {
repairTime.NumberOfRepairGenius(GeniusNumber.selectedSegmentIndex+1)
CurrentTimerepair.text = String(format:"%.1f", repairTime.TimeOfRepair())
RFPTime.text = String(repairTime.ReadyForPickup())
}
#IBAction func AddBr(sender: AnyObject) {
repairTime.NumberOfBatteryRepair(repairTime.getNumberOfBatteryRepair()+1)
CurrentTimerepair.text = String(format:"%.1f", repairTime.TimeOfRepair())
RFPTime.text = String(repairTime.ReadyForPickup())
}
#IBAction func AddOr(sender: AnyObject) {
repairTime.NumberOfOtherRepair(repairTime.getNumberOfOtherRepair()+1)
CurrentTimerepair.text = String(format:"%.1f", repairTime.TimeOfRepair())
RFPTime.text = String(repairTime.ReadyForPickup())
}
#IBAction func AddBCr(sender: AnyObject) {
repairTime.NumberOfBackCoverRepair(repairTime.getNumberOfBackCoverRepair()+1)
CurrentTimerepair.text = String(format:"%.1f", repairTime.TimeOfRepair())
RFPTime.text = String(repairTime.ReadyForPickup())
}
#IBAction func AddDr(sender: AnyObject) {
repairTime.NumberOfDisplayRepair(repairTime.getNumberOfDisplayRepair()+1)
CurrentTimerepair.text = String(format:"%.1f", repairTime.TimeOfRepair())
RFPTime.text = String(repairTime.ReadyForPickup())
//print("view controler")
//print(
}
#IBAction func DeleteBr(sender: AnyObject) {
if(repairTime.getNumberOfBatteryRepair() != 0){
repairTime.NumberOfBatteryRepair(repairTime.getNumberOfBatteryRepair()-1)
CurrentTimerepair.text = String(format:"%.1f", repairTime.TimeOfRepair())
RFPTime.text = String(repairTime.ReadyForPickup())
}
}
#IBAction func DeleteOr(sender: AnyObject) {
if(repairTime.getNumberOfOtherRepair() != 0){
repairTime.NumberOfOtherRepair(repairTime.getNumberOfOtherRepair()-1)
CurrentTimerepair.text = String(format:"%.1f", repairTime.TimeOfRepair())
RFPTime.text = String(repairTime.ReadyForPickup())
}
}
#IBAction func DeleteBCr(sender: AnyObject) {
if(repairTime.getNumberOfBackCoverRepair() != 0){
repairTime.NumberOfBackCoverRepair(repairTime.getNumberOfBackCoverRepair()-1)
CurrentTimerepair.text = String(format:"%.1f", repairTime.TimeOfRepair())
RFPTime.text = String(repairTime.ReadyForPickup())
}
}
#IBAction func DeleteDr(sender: AnyObject) {
if(repairTime.getNumberOfDisplayRepair() != 0){
repairTime.NumberOfDisplayRepair(repairTime.getNumberOfDisplayRepair()-1)
CurrentTimerepair.text = String(format:"%.1f", repairTime.TimeOfRepair())
RFPTime.text = String(repairTime.ReadyForPickup())
}
}
#IBAction func ShowQueuePop(sender: AnyObject) {
let out="Display Repair: \(repairTime.getNumberOfDisplayRepair()) \n Other Repair: \(repairTime.getNumberOfOtherRepair()) \n Battery Repair: \(repairTime.getNumberOfBatteryRepair()) \n Back Cover Repair: \(repairTime.getNumberOfBackCoverRepair())"
let alertController = UIAlertController(title: "Current repair Queue", message: out
, preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.Default,handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
}
class RepairTime {
var optiontime = OptionTime()
var RepairGenius: Int = 1
var DisplayRepair: Int = 0
var OtherRepair: Int = 0
var BackCoverRepair: Int = 0
var BatteryRepair: Int = 0
func TimeOfRepair()->Double{
var repairtimezwei: Double
repairtimezwei=0.0
var repairzeit: Int
repairzeit=0
repairzeit=(BatteryRepair*optiontime.BatteryTime)+(BackCoverRepair*optiontime.BCTime)+(DisplayRepair*optiontime.DisplayTime)+(OtherRepair*optiontime.OtherTime)
//print(DisplayRepair)
repairtimezwei = (Double(repairzeit)/Double(RepairGenius))+15.0
return repairtimezwei
}
so and this is my second viewController:
class ViewController2: UIViewController,UITextFieldDelegate {
var optiontime = OptionTime()
#IBOutlet weak var DisplayTime: UITextField!
#IBOutlet weak var BatteryTime: UITextField!
#IBOutlet weak var BackCoverTime: UITextField!
#IBOutlet weak var OtherTime: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
//RFPTime.text = repairTime.ReadyForPickup()
// set TextField with Values of struct optionTime from class RepairTime
DisplayTime.text=String(optiontime.DisplayTime)
BatteryTime.text=String(optiontime.BatteryTime)
BackCoverTime.text=String(optiontime.BCTime)
OtherTime.text=String(optiontime.OtherTime)
//set KeybardType for Textinputs
self.DisplayTime.keyboardType = UIKeyboardType.NumbersAndPunctuation
self.BatteryTime.keyboardType = UIKeyboardType.NumbersAndPunctuation
self.BackCoverTime.keyboardType = UIKeyboardType.NumbersAndPunctuation
self.OtherTime.keyboardType = UIKeyboardType.NumbersAndPunctuation
self.DisplayTime.delegate = self
self.BatteryTime.delegate = self
self.BackCoverTime.delegate = self
self.OtherTime.delegate = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func textFieldShouldReturn(textField: UITextField) -> Bool {
self.view.endEditing(true)
return false
}
#IBAction func TimeChangeDisplay(sender: AnyObject) {
optiontime.DisplayTime = Int(DisplayTime.text!)!
print("vie controler 2")
print(optiontime.DisplayTime)
}
#IBAction func TimeChangeBattery(sender: AnyObject) {
optiontime.BatteryTime = Int(BatteryTime.text!)!
}
#IBAction func TimeChangeBC(sender: AnyObject) {
optiontime.BCTime = Int(BackCoverTime.text!)!
}
#IBAction func TimeChangeOther(sender: AnyObject) {
optiontime.OtherTime = Int(OtherTime.text!)!
}
}
My Problem is that the value of the struct after finishing the edit in the textfield didn't change.