I have met with a strange issue in my framework project. The Swift 3 compiler is warning me of an unused result when I try to call a function in my framework, even though I have marked the function in framework with @discardableResult
Here is my code
SampleFramework.swift file in my cocoa touch framework project
import Foundation
@discardableResult
public func keychainPerform(key:String) -> String{
print("success");
return "aaa";
}
ViewController.swift file in single view application swift project
import UIKit
import SampleFramework
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
SampleFramework.keychainPerform(key: "asd") // Warning: result of call is unused
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
I checked the scenario with other frameworks but @discardableResult is working perfectly on all of them, so please help me to find out what I am doing wrong?