discardableResult

    [swift] @discardableResult 키워드

    애플이 제공하는 어트리뷰트 키워드 중 하나인 discardableResult에 대한 포스팅입니다. discardableResult Apply this attribute to a function or method declaration to suppress the compiler warning when the function or method that returns a value is called without using its result. swift 공식 문서에는 이렇게 설명이 되어있습니다. 대충 함수의 return 값을 사용하지 않는데 경고가 뜨는 걸 막고 싶을 때 이걸 써라 ~ 이런 느낌 예시 출동 func add(x: Int, y: Int) -> Int { return x + y } 이렇게 함수를 ..