---
title: "How to Typecast Obligation is Apple Swift?"  
description: "How to Typecast Obligation is Apple Swift?"  
author: "Anonymous User"  
published: 2014-10-17  
updated: 2014-10-17  
canonical: https://www.mindstick.com/forum/2407/how-to-typecast-obligation-is-apple-swift  
category: "iphone"  
tags: ["iphone", "ios"]  
reading_time: 1 minute  

---

# How to Typecast Obligation is Apple Swift?

Am I [missing](https://answers.mindstick.com/qa/52138/international-missing-children-s-day-2019-was-observed-on) something or typecast is obligatory while adding numbers having different types:\
[var](https://www.mindstick.com/forum/33920/what-is-different-var-and-dynamic-types-in-c-sharp) i:[Int](https://www.mindstick.com/forum/159137/how-to-convert-date-int-to-date-in-sql)=5var d:Double=6.0\
var q:Double= i + d var w:Double= Double(i) + d

## Replies

### Reply by Anonymous User

Swift doesn't provide automatic conversion between numeric types.\
Normally you just perform conversions like you used in your question.\
I don't recommend it, but you could do this:\

```
func +(i:Int, d:Double) -> Double {    return Double(i) + d}let i: Int = 1let d: Double = 7.0i + d// result: 8.0
```

You would need to provide a lot of overrides to cover all the bases. Like I said, I don't recommend it.


---

Original Source: https://www.mindstick.com/forum/2407/how-to-typecast-obligation-is-apple-swift

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
