Fixed optional unwrapping
This commit is contained in:
@@ -38,7 +38,7 @@ class AlarmActivationViewController: UIViewController
|
||||
|
||||
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(AlarmActivationViewController.playSound), userInfo: nil, repeats: true)
|
||||
setAlarmType()
|
||||
print(MathExpression.random())
|
||||
//print(MathExpression.random())
|
||||
}
|
||||
|
||||
@objc func playSound()
|
||||
@@ -68,8 +68,13 @@ class AlarmActivationViewController: UIViewController
|
||||
}
|
||||
|
||||
@IBAction func checkPuzzleSolution(_ sender: Any) {
|
||||
if puzzleAnswers.contains(Int(puzzleAnswerInput.text!)!) {
|
||||
print("alarm solved")
|
||||
if let input = puzzleAnswerInput.text {
|
||||
if let numericalInput = Int(input) {
|
||||
if puzzleAnswers.contains(numericalInput) {
|
||||
timer?.invalidate()
|
||||
print("Alarm solved")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="s8U-C8-W2S">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="s8U-C8-W2S">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
|
||||
@@ -139,7 +139,7 @@ class QuadraticProb {
|
||||
let b = root1 + root2 //bx
|
||||
let c = root1 * root2 //x
|
||||
|
||||
return "x^2 + \(b) + \(c)"
|
||||
return "x^2 + \(b)x + \(c)"
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user