Avatar
Avatar
nanasi
@swift-5.6.3 @swift-5.5.3 import Foundation @propertyWrapper struct Wrapper { var wrappedValue: Int? var projectedValue: String? init(wrappedValue: Int?) { self.wrappedValue = wrappedValue } init(projectedValue: String?) { self.projectedValue = projectedValue } } func foo(@Wrapper value: Int?) { print(value) } foo(value: 100) foo($value: "string")
swift56 BOT 2/8/2022 3:23 AM
Optional(100) nilstderr:<stdin>:18:9: warning: expression implicitly coerced from 'Int?' to 'Any' print(value) ^~~~~ <stdin>:18:9: note: provide a default value to avoid this warning print(value) ^~~~~ ?? <#default value#> <stdin>:18:9: note: force-unwrap the value to avoid this warning print(value) ^~~~~ ! <stdin>:18:9: note: explicitly cast to 'Any' with 'as Any' to silence this warning print(value) ^~~~~ as Any