Skip to content

v1.1.0

Compare
Choose a tag to compare
@backslash-f backslash-f released this 17 Dec 12:35
· 9 commits to master since this release
01f027e

The device's orientation is now available (only in iOS and Mac Catalyst).

let device = Device()

// At any time:
let currentOrientation = device.orientation

// Observe orientation changes:
var cancellables = Set<AnyCancellable>()
device.$orientation
    .sink { orientation in
        switch orientation {
        case .portrait:
            // Do portrait stuff
        case .landscapeRight:
            // Do landscape stuff
        default:
            // Handle .faceDown, .faceUp, .landscapeLeft, .portraitUpsideDown, .unknown, etc
        }
    }
    .store(in: &cancellables)