[nfbcs] Specific swift errors
Jessica Dail
jldail13 at gmail.com
Mon Jul 30 19:26:39 UTC 2018
Hi,
I’m not sure where they’re from, so I’ll send my whole code.
Here it is.
let button = UIButton()
button.addTarget(self, action: #selector(buttonAction), for: .touchUpInside)
button.frame = CGRect(x: 400, y: 300, width: 500, height: 50)
button.backgroundColor = UIColor.black
button.setTitle("start ", for: .normal)
self.view.addSubview(button)
}
@objc func buttonAction(sender: UIButton!) {
var update=true
var counter=0
let timelabel=UILabel()
var timer = Timer.scheduledTimer(timeInterval: 0.4, target: self, selector: #selector(update), userInfo: nil, repeats: true)
timelabel.frame = CGRect(x: 150, y: 200, width: 200, height: 20)
timelabel.text=("0")
self.view.addSubview(timelabel)
timelabel.text=String(counter)
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
I hope this helps.
Thanks,
Jessica
> On Jul 30, 2018, at 3:19 PM, Drenth, Joe via nfbcs <nfbcs at nfbnet.org> wrote:
>
> Hi Jessica,
>
> It would help to see the lines of code related to those errors, because they are highly context-sensitive.
>
> Joseph Drenth
> Senior R&D Software Engineer
> JBT Corporation | Automated Systems
> 400 Highpoint Drive
> Chalfont, PA 18914, USA
> E: joe.drenth at jbtc.com P: 215 822 4457
> www.jbtc-agv.com
>
>
> -----Original Message-----
> From: nfbcs [mailto:nfbcs-bounces at nfbnet.org] On Behalf Of Jessica Dail via nfbcs
> Sent: Monday, July 30, 2018 2:47 PM
> To: NFB in Computer Science Mailing List
> Cc: Jessica Dail
> Subject: [nfbcs] Specific swift errors
>
> Hi,
> I’ll give the full list of errors I’m getting, in hopes that someone can help.
>
>
>
> again/ViewController.swift:28:85: Argument of '#selector' cannot refer to variable 'update'
> again/ViewController.swift:25:13: 'update' declared here Warning Group
> again/ViewController.swift:25:13: Variable 'update' was never mutated; consider changing to 'let' constant
> again/ViewController.swift:26:5: Variable 'counter' was never mutated; consider changing to 'let' constant /Users/jessica/Dropbox/Swift/stop watch again/stop watch again/ViewController.swift:28:13: Initialization of variable 'timer' was never used; consider replacing with assignment to '_' or removing it
>
> Does anyone know what these mean, in simple terms?
>
> Everything I found online, is long & hard to understand.
>
> Thanks,
> Jessica
>
>
> _______________________________________________
> nfbcs mailing list
> nfbcs at nfbnet.org
> http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
> To unsubscribe, change your list options or get your account info for nfbcs:
> http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/joe.drenth%40jbtc.com
> _______________________________________________
> nfbcs mailing list
> nfbcs at nfbnet.org
> http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
> To unsubscribe, change your list options or get your account info for nfbcs:
> http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/jldail13%40gmail.com
More information about the NFBCS
mailing list