forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UIKit.swift
47 lines (41 loc) · 1.9 KB
/
UIKit.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// RUN: %target-run-simple-swift | FileCheck %s
// REQUIRES: OS=ios
import UIKit
func printOrientation(o: UIDeviceOrientation) {
print ("\(o.isPortrait) \(UIDeviceOrientationIsPortrait(o)), ")
print ("\(o.isLandscape) \(UIDeviceOrientationIsLandscape(o)), ")
print ("\(o.isFlat), ")
println("\(o.isValidInterfaceOrientation) \(UIDeviceOrientationIsValidInterfaceOrientation(o))")
}
println("Device orientations")
printOrientation(UIDeviceOrientation.Unknown)
printOrientation(UIDeviceOrientation.Portrait)
printOrientation(UIDeviceOrientation.PortraitUpsideDown)
printOrientation(UIDeviceOrientation.LandscapeLeft)
printOrientation(UIDeviceOrientation.LandscapeRight)
printOrientation(UIDeviceOrientation.FaceUp)
printOrientation(UIDeviceOrientation.FaceDown)
// CHECK: Device orientations
// CHECK-NEXT: false false, false false, false, false false
// CHECK-NEXT: true true, false false, false, true true
// CHECK-NEXT: true true, false false, false, true true
// CHECK-NEXT: false false, true true, false, true true
// CHECK-NEXT: false false, true true, false, true true
// CHECK-NEXT: false false, false false, true, false false
// CHECK-NEXT: false false, false false, true, false false
func printOrientation(o: UIInterfaceOrientation) {
print ("\(o.isPortrait) \(UIInterfaceOrientationIsPortrait(o)), ")
println("\(o.isLandscape) \(UIInterfaceOrientationIsLandscape(o))")
}
println("Interface orientations")
printOrientation(UIInterfaceOrientation.Unknown)
printOrientation(UIInterfaceOrientation.Portrait)
printOrientation(UIInterfaceOrientation.PortraitUpsideDown)
printOrientation(UIInterfaceOrientation.LandscapeLeft)
printOrientation(UIInterfaceOrientation.LandscapeRight)
// CHECK: Interface orientations
// CHECK-NEXT: false false, false false
// CHECK-NEXT: true true, false false
// CHECK-NEXT: true true, false false
// CHECK-NEXT: false false, true true
// CHECK-NEXT: false false, true true