I manage different languages ββin a small application with one panel, using a different string array for each comment, indexed by the integer variable userLang, and then setting label.text = array [index]. Main code:
import UIKit class ViewController: UIViewController { var userLang = 0 var arrayOne = ["hi", "hola"] var arrayTwo = ["Bye", "Adios"] @IBOutlet weak var msgArrayOne: UILabel! @IBOutlet weak var msgArrayTwo: UILabel! msgArrayOne.text = arrayOne[userLang]
I keep getting the "Pending declaration" error. I tried using a simple quoted string (instead of an array) as a test and still getting the same error. I searched the Internet and did not find any suggestions that solve the problem. I tried to change the name if the label, in case I used the "reserved" links.
I was looking for the Apple developer guide for Swift and could not find the correct shortcut syntax. This syntax worked in other projects, so I'm not sure what is going on. I even tried to copy / paste the appropriate sections into a new project (one of the suggestions online, in case of an Xcode error), without any better results. I noticed that small differences (space or capital) can make a big difference in Swift. Is something I am doing wrong here? Any suggestions?
string swift labels
Rob
source share