In Swift 3 you can omit the associated value of type Void
:
let res: Result<Void> = .success()
In Swift 4 you have to pass an associated value of type Void
:
let res: Result<Void> = .success(())
// Or just:
let res = Result.success(())
More Related Contents:
- How can I deal with @objc inference deprecation with #selector() in Swift 4?
- How to use swift 4 Codable in Core Data?
- How to enumerate an enum with String type?
- How can I use String substring in Swift 4? ‘substring(to:)’ is deprecated: Please use String slicing subscript with a ‘partial range from’ operator
- The use of Swift 3 @objc inference in Swift 4 mode is deprecated?
- Swift constants: Struct or Enum
- Using Decodable in Swift 4 with Inheritance
- How to compare enum with associated values by ignoring its associated value in Swift?
- How do I get the count of a Swift enum?
- How can I use Swift’s Codable to encode into a dictionary?
- Forced to cast, even if protocol requires given type
- Value of type ‘StorageMetadata’ has no member ‘downloadURL’
- How do I make an enum Decodable in Swift?
- Simultaneous accesses to 0x1c0a7f0f8, but modification requires exclusive access error on Xcode 9 beta 4
- What is difference between optional and decodeIfPresent when using Decodable for JSON Parsing?
- Difference between flatMap and compactMap in Swift
- How do I encode enum using NSCoder in swift?
- Get associated value from enumeration without switch/case
- HMAC SHA256 in Swift 4
- Compile error in Swift 4 on parameter passing
- Using Codable on a dynamic type/object
- In Swift 4, how do I remove a block-based KVO observer?
- Use reserved keyword a enum case
- Swift double to string
- Attach parameter to button.addTarget action in Swift
- Xcode 8 Beta 3 Use Legacy Swift issue
- Difference between == and ===
- Load local web files & resources in WKWebView
- Swift: Convert enum value to String?
- How to use an NSAttributedString with a ScrollView in SwiftUI?