Skip to content

Instantly share code, notes, and snippets.

View TomQDRS's full-sized avatar
🏳️‍🌈

TomQDRS TomQDRS

🏳️‍🌈
  • Münster, Germany
View GitHub Profile
@ajself
ajself / rotatable.swift
Last active May 27, 2024 12:11
Rotate UIViewControllers that conform to a protocol
/*
This is an update to an example found on http://www.jairobjunior.com/blog/2016/03/05/how-to-rotate-only-one-view-controller-to-landscape-in-ios-slash-swift/
The code there works, with some updating to the latest Swift, but the pattern isn't very Swifty. The following is what I found to be more helpful.
*/
/*
First, create a protocol that UIViewController's can conform to.
This is in opposition to using `Selector()` and checking for the presence of an empty function.
*/