0

I have the following variable: private var screenWidth = UIScreen.mainScreen().bounds.width

I was wondering how I could set a property observer on it? Or get the latest version of it when it updates?

Foobar
  • 7,458
  • 16
  • 81
  • 161

1 Answers1

1

There's no general approach that works for everything. You can often use Key-Value Observing. In this case, you can listen for the UIScreenModeDidChangeNotification notification.

Jim
  • 72,985
  • 14
  • 101
  • 108