Swift

Swift

Made by DeepSource

Unimplemented functions should be marked as unavailable SW-W1014

Bug risk
Minor

Unimplemented functions in Swift code can cause confusion for users who may think the function is available to use. This can lead to runtime errors and unexpected behavior. To prevent this issue, it's recommended to mark any unimplemented functions as unavailable using the @available attribute. This communicates to users that the function is not yet implemented and should not be used.

Bad Practice

func unimplementedFunction() -> String {
  fatalError("This function is not yet implemented")
}

Recommended

@available(*, unavailable, message: "This function is not yet implemented")
func unimplementedFunction() -> String {
  fatalError("This function is not yet implemented")
}