Converting Boolean value to Integer value in swift 3 : <p>I was converting from swift 2 to swift 3. I noticed that I cannot convert a boolean value to integer value in swift 3 :\ .</p>

<pre><code>let p1 = ("a" == "a") //true

print(true)           //"true\n"
print(p1)             //"true\n"

Int(true)             //1

Int(p1)               //error
</code></pre>

<p>For example these syntaxes worked fine in swift 2. But in swift 3, <code>print(p1)</code> yields an error.</p>

<p>The error is <code>error: cannot invoke initializer for type 'Int' with an argument list of type '((Bool))'</code></p>

<p>I understand why the errors are happening. Can anyone explain what is the reason for this safety and how to convert from Bool to Int in swift 3?</p>
