> On Sep 15, 2015, at 21:04, Quincey Morris
> <[email protected]> wrote:
>
>> My only remaining wonder is about setting the accessibilityHelp property,
>> which is giving me the same error it always has: self is immutable.
>
> You’re going to have to post a few text fragments to show what’s going on,
> that show how the variables are declared. Context is important here.
Here you go. I have a basic Mac app in Swift. My view controller is a subclass
of NSTextFieldDelegate, and the outlet to a text field in the storyboard is
named myField. Here's the only stuff in my view controller beyond the
boilerplate code:
@IBOutlet weak var myField:NSTextField! //connected to the text field in the
storyboard
func textDidChange(notification:NSNotification) {
print("text changed.")
myField.accessibilityHelp="new help message"
}
The line setting the value of myField.accessibilityHelp has the error "cannot
assign to property: 'self' is immutable". Comment out that line and the app
runs normally. The function doesn't get triggered, because I think I need
controlTextDidChange instead, but the point is that I see that error as soon as
I try to modify the accessibility details of the text field, and the app won't
even build.
>
> Keep in mind that with Swift, the error that’s reported is still sometimes a
> secondary error. What it says may not be a good clue to what’s wrong.
--
Have a great day,
Alex Hall
[email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]