From 156cac0bde088511bbbac6c08f2b3f2e4eb75829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Costa?= Date: Wed, 27 May 2026 10:15:03 +0100 Subject: [PATCH] Add 'as Any' cast for optional people property values in Swift Optional values (e.g. value?.rawValue) coerced to Any trigger a Swift compiler warning. Non-optional values coerce silently, so only optional property expressions need the explicit 'as Any' cast. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/evva/templates/swift/people_properties.swift | 2 +- spec/lib/evva/swift_generator_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/evva/templates/swift/people_properties.swift b/lib/evva/templates/swift/people_properties.swift index 9282f5f..5d7a732 100644 --- a/lib/evva/templates/swift/people_properties.swift +++ b/lib/evva/templates/swift/people_properties.swift @@ -40,7 +40,7 @@ enum Property { <%- properties.each_with_index do |p, index| -%> case let .<%= p[:case_name] %>(value): return PropertyData(type: .<%= p[:case_name] %>, - value: value<% if p[:is_special_property] %><%= "?" if p[:is_optional] %>.rawValue<% end %>) + value: value<% if p[:is_special_property] %><%= "?" if p[:is_optional] %>.rawValue<% end %><%= " as Any" if p[:is_optional] %>) <%- unless index == properties.count - 1 -%> <%- end -%> diff --git a/spec/lib/evva/swift_generator_spec.rb b/spec/lib/evva/swift_generator_spec.rb index 027d6d6..8fe982f 100644 --- a/spec/lib/evva/swift_generator_spec.rb +++ b/spec/lib/evva/swift_generator_spec.rb @@ -213,7 +213,7 @@ case let .reverseTrialType(value): return PropertyData(type: .reverseTrialType, - value: value?.rawValue) + value: value?.rawValue as Any) case let .numberOfTimesItHappened(value): return PropertyData(type: .numberOfTimesItHappened,