Reputation: 1168
I just ran my project in Xcode8 it asked me to convert to swift3 syntax's so I did it, Obviously there are many errors those errors I am fixing from 2 days. After I converted all to swift3 step by step(error resolving). But when I build it is not even ran once either in device or simulator.
Why it is not moving further ?
It is not even throwing any errors to fix any(checked all again and again)
I am worried. Is there anything I need to check in build settings or in code ?
Please refer below image
Warnings:
Upvotes: 1
Views: 221
Reputation: 1168
Sometimes Compiler is not detecting all errors in Xcode8
So I started commenting one by one method/class in swift files
There i found one method is troubling compiler which has not updated to swift3 syntax's after that i changed those syntax's then it ran successfully
Many things we need to check if anyone facing above issue in Xcode8 Swift3 Please refer below syntax's
Thank you for the above comments which helps me to think about the issue
//let fetchRequest = NSFetchRequest()
let fetchRequest = NSFetchRequest<Sample>(entityName: "Sample")
func getPageThumbnail(upc:String, pagenum:Int)-> UIImage
{
}
Before:
if let xImage = GF.getPageThumbnail(self.upcLabel.text!, pagenum: 3) as UIImage?
Now in Swift3:
if let xImage = GF.getPageThumbnail(upc:self.upcLabel.text!, pagenum: 3) as UIImage?
DispatchQueue.global().async {
DispatchQueue.main.async {
}
}
CGRect(x:0, y:0, width:80, height:80)
CGPoint(x:10, y:20);
let myTapGesture = UITapGestureRecognizer(target: self, action: #selector(tapped(_:)) )
func tapped(_ sender: UITapGestureRecognizer) {
}
extension String {
// right(x) and left(x) function to get substring
func right(i: Int) -> String?
{
return self[self.length-i ... self.length-1 ]
}
func left(i: Int) -> String?
{
return self[0 ... i-1]
}
subscript (i: Int) -> Character {
return self[self.characters.index(self.startIndex, offsetBy: i)]
}
subscript (i: Int) -> String {
return String(self[i] as Character)
}
//added swift3 replacement
subscript (r: CountableClosedRange<Int>) -> String {
get {
let startIndex = self.index(self.startIndex, offsetBy: r.lowerBound)
let endIndex = self.index(startIndex, offsetBy: r.upperBound - r.lowerBound)
return self[startIndex...endIndex]
}
}
}
Upvotes: 1