So I've made a very simple iOS app in SWiFT for the sake of experimentation that displays a string at the touch of a button I've successfully implemented and tested the watchOS version and it runs fine on my devices. What I want to do is add haptic .Click to the button in the watch app. Now I did some research and it says in ever article "it's easy just call it like this"
i started by Importing the WatchKit as stated in posts such as Where to find Taptic feedback API documentation or capabilities for watchOS 2?
import UIKit
import WatchKit
class ViewController: UIViewController {
@IBOutlet weak var Button1: UIButton!
@IBOutlet weak var LabelView: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func ButtonPressed(sender: UIButton) {
// Directly Call the function in the Action
WKInterfaceDevice.currentDevice().playHaptic(.Click)
var myString = “Hello, World!”
LabelView.text = “\(myString)”
}
}
If this is the case (which I'm guessing it is not) then there is something wrong with my machine, or much more likely my code is wrong and more importantly I haven't understood the topic.
When I try to build the above example it fails at the Haptics line with the error:
"playHaptic" is unavailable.
This is screaming include issues but I have
Import WatchKit
So I thought I was good and I'm forcing the .Click parameter so it looks ok but I've only been doing this a week so please forgive my lack of knowledge.
ANY AND ALL COMMENTS AND HELP ARE HUGELY APPRECIATED AS EVER!
I look forward to hearing from you all :)
EDIT:
iv also just read and experimented with the example HERE but when i try and repurpose it in my app its not happening.
i get the same errors like the libraries are not accessible.
do i need to import with the bridging method instead of directly in my swift file?