rspec/rules/S3630/swift/rule.adoc

16 lines
373 B
Plaintext
Raw Normal View History

2020-12-23 14:59:06 +01:00
Because force casting (``as!``) does not perform any type safety validations, it is capable of performing dangerous conversions between unrelated types. When the types are truly unrelated, the cast will cause a system crash.
2020-06-30 12:48:39 +02:00
== Noncompliant Code Example
----
foo as! MyClass // Noncompliant
----
== Compliant Solution
----
foo as? MyClass
----
include::../see.adoc[]