Skip to content

Commit

Permalink
Use let
Browse files Browse the repository at this point in the history
In the case of "value", as result of Swift 1.2:

  "let constants have been generalized to no longer require immediate
   initialization. The new rule is that a let constant must be initialized
   before use (like a var), and that it may only be initialized: not reassigned
   or mutated after initialization." - via release notes
  • Loading branch information
beltex committed Feb 17, 2015
1 parent 233761c commit 62cb942
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dshb/BatteryWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct BatteryWidget: Widget {


mutating func draw() {
var charge = battery.charge()
let charge = battery.charge()
meters[0].draw(String(Int(battery.charge())),
percentage: charge / 100.0)

Expand Down
2 changes: 1 addition & 1 deletion dshb/TMPWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct TMPWidget: Widget {

mutating func draw() {
for var i = 0; i < meters.count; ++i {
var value = 0.0
let value: Double
switch meters[i].name {
case "BATTERY":
value = battery.temperature()
Expand Down

0 comments on commit 62cb942

Please sign in to comment.