Result of call to 'sorted(by:)' is unused
.sorted(by: )
returns the sorted array, if you need the sorted array and leave the original array untouched.
.sort(by:)
it doesn't returns anything, it sorts the original array.
If you don't care about original array being modified, then use .sort(by:)
Result of call is unused
You are confusing the results
variable, which is, indeed, used inside the closure, and the result of the taskForDELETEMethod
call itself, which is NSURLSessionDataTask
object.
From the examples of using taskForDELETEMethod
that I was able to find online it looks like it is perfectly OK to ignore the return value, so you can avoid this warning by assigning the result to _
variable, i.e.
let _ = taskForDELETEMethod {
... // The rest of your code goes here
}
Swift result of call to is unused
Assign the return value of the function to _
to explicitly discard it, like this:
_ = somethingThatReturnsAValueYouDontCareAbout()
Swift 3 warns about unused function return values, so you need to show it that you know what you're doing.
Swift Compiler Warning : Result of call to 'save(defaults:)' is unused
The DataHandling
instance's save(defaults:)
function technically returns a value, even if you don't use it. To silence this warning, assign it to _
to signify that you don't intend to use the result value, e.g.:
_ = ordering.save(defaults: indexPath.defaultsKey)
or
let _ = ordering.save(defaults: indexPath.defaultsKey)
Just to be clear, this is almost definitely not why your tableview is not loading data. It should be pretty insignificant. The indexPath.defaultsKey
is being saved (assuming the API works).
SceneDelegate - Result of call to 'flatMap' is unused
You could rewrite like this:
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
if let url = userActivity.webpageURL {
handlePasswordlessSignIn(withURL:url)
}
}
But then you will still get a complaint, because now you are ignoring the result of handlePasswordlessSignIn
! You can solve that by designating handlePasswordlessSignIn
as being @discardableResult
:
@discardableResult
func handlePasswordlessSignIn( //...
Result of call to 'rotationEffect(_:anchor:)' is unused
Rather than trying to return a a new View
from inside a function that you call as a Button
action, you need to modify a @State
property that controls the rotation angle when the user taps the button.
struct RotatingView: View {
@State private var rotationAngle: Double = 0
let titleContent: String
var body: some View {
ZStack {
VStack {
Text(titleContent)
.fontWeight(.heavy)
.font(Font.custom("Benguiat Bold", size: 35))
.foregroundColor(.red)
.padding()
.rotationEffect(.degrees(rotationAngle))
Button(action: {
rotationAngle += 180
}, label: {
Text("Enter upside down")
.foregroundColor(.white)
.font(.title2)
.fontWeight(.bold)
.padding()
.border(Color.green, width: 3)
.cornerRadius(10)
.padding()
})
}
}
}
}
Related Topics
Swiftui Behavior of .Frame(Height: Nil)
How to Handle Menu Button Action in Tvos Remote
Sharing File Data Between Applications in Swift/Ios
Get a List of Nodes in an Specific Area
Xcode 9 Fails to Build Swift 4 Project with Pod
Swift Optional Type: How .None == Nil Works
Swift 4.2 - _Shared Attribute Near Type
Accessing Global Variable in Swift
Extending Typed Array by Conforming to a Protocol in Swift 2
Saving Swifty JSON Array to User Defaults
Lottieanimationview Size Won't Change/Is Too Small (Ios/Swift)
How to Pass/Get Core Data Context in Swiftui Mvvm Viewmodel
Change a Dictionary's Key in Swift
Stack Overflow When Defining Subscript on Ckrecord in Swift
How to Draw Dashed Line in Arkit (Scenekit) Like in the Measure App