concept offset in category ios
appears as: offset

This is an excerpt from Manning's book iOS Development with Swift.
Unwrap the firstResponder property from the UIViewController extension you created. If no first responder exists, you can safely assume that the user isn’t editing a field, and the offset of the view should be zero. var offset: CGFloat = 0 1 if let firstResponder = firstResponder { 2 3 }Now that you have the first responder, you can calculate the offset to animate the view.
- 1 Creates offset variable of 0
- 2 Unwraps first responder
- 3 Defines offset here