I have tried to make my own currency converter from USD to SEK With the import taxes rates to Sweden but I have no clue how to take a value from a website. I have tried to find it on my own but I can't really find anything so I´m hopping anyone here could help me with this? This is how far I have built the app.
import UIKit
class ImportSkattViewController: UIViewController {
@IBOutlet weak var textfield: UITextField!
@IBOutlet weak var svar: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
textfield.keyboardType = UIKeyboardType.DecimalPad
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: "dismissKeyboard")
view.addGestureRecognizer(tap)
// Do any additional setup after loading the view.
}
func dismissKeyboard() {
//Causes the view (or one of its embedded text fields) to resign the first responder status.
view.endEditing(true)
if textfield.text == ""{
}
else{
let nf = NSNumberFormatter()
let atext2 = nf.numberFromString(textfield.text!)
let skatt = 1.25
let CurencyValue = 0
let result = Float(atext2!) * Float(skatt) * Float(CurencyValue)
svar.text = ("(result)")
}
}
override func didReceiveMemoryWaing() {
super.didReceiveMemoryWaing()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
