[swift-users] How to write better Swift

Gerriet M. Denkmann g at mdenkmann.de
Sat Jul 8 07:19:58 CDT 2017


This works (Xcode Version 8.3.2 (8E2002)):

class SomeClass
{
	private var privateStatus: Int	

	var status: Int
	{
		get{ return privateStatus }
		set(new)
		{
			if new == privateStatus {return}
		
			… do something here …

			privateStatus = new
		}
	}
}

But is this “privateStatus” really necessary?
If not, how can it be avoided?

Gerriet.



More information about the swift-users mailing list