I am wondering what does '!' (exclamation mark), next to the name of the file mean in Xcode. I know that it is meant to tell you that a file is "Missing", but I couldn't find any online explanation. And I also need a way to fix it. I can edit the code inside of the so-called "Missing" file. When I run it into the simulator everything works completely fine, no error and not even a warning.
I am running Xcode 8 with Swift 3.
1. The file inside my editor:
2. Simulator:
import Foundation
import UIKit
class Documentation: UIViewController {
@IBOutlet weak var Basics: UIButton!
let defaults = UserDefaults.standard
override func viewDidLoad() {
super.viewDidLoad()
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
let menuButton = UIBarButtonItem(barButtonSystemItem: .organize, target: self.revealViewController(), action: #selector(SWRevealViewController.revealToggle(_:)))
menuButton.tintColor = UIColor.white
self.navigationItem.leftBarButtonItem = menuButton
self.customizeButton(button: Basics, angle: 50, borderWidth: 2, borderColor: #colorLiteral(red: 0.0693108514, green: 0, blue: 0.2353696823, alpha: 1))
}
@IBAction func BasicsAction(_ sender: UIButton) {
}
func customizeButton(button: UIButton, angle: Int, borderWidth: Int, borderColor: UIColor){
button.layer.cornerRadius = CGFloat(angle)
button.layer.borderWidth = CGFloat(borderWidth)
button.layer.borderColor = borderColor.cgColor
let completionLabel = button.viewWithTag(1) as! UILabel!
completionLabel?.text = "0/10"
if defaults.value(forKey: "\(button.currentTitle)") != nil{
let done = defaults.value(forKey: "\(button.currentTitle)") as! Int
completionLabel?.text = "\(done)/10"
if done == 10{
button.layer.borderColor = #colorLiteral(red: 0.2193539292, green: 0.4209204912, blue: 0.1073316187, alpha: 1).cgColor
button.layer.borderWidth = 5
}
}
}
}
Any help is greatly appreciated if it comes with a good explanation!
The exclamation mark indicates that the name property of the Person class is defined as an implicitly unwrapped optional. Note that the print statement returns the value of name , not an optional.
Those icons mean that the files need to be backed up. You can turn them off, if you want to.
Swift uses exclamation marks to signal both force unwrapping of optionals and explicitly unwrapped optionals.
Since the "M
" and "A
" and "!
" are referring to your repositories, I suspect that this file lives on your local drive but, for some reason, isn't found in wherever you are keeping your files remotely (GitHub, BitBucket, Subversion, etc.).
1)
If this were my problem, I'd look on your remote repository first to make sure the file exists there.
2)
Then I would also look at the path of the local file. Sure you can open it from your project/workspace, but perhaps it's in a different place/folder than all of the other source files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With