TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | Apache 2 |
ReleasedLast Release | May 2015 |
SPMSupports SPM | ✗ |
Maintained by Robert Payne.
A tasty bit of Swift to make writing device and/or screen size specific code.
While QuerySize supports iOS 7.0, frameworks are not supported for iOS 7.0 so you must manually embed the framework for non app store apps or integrate the source files directly.
The first thing you’ll need to do with QuerySize is get it installed into your project. We support three different integrations:
cd
-ing into your top-level project directory, and entering the following command:$ git submodule add https://github.com/QuerySize/QuerySize.git
QuerySize
folder, and drag QuerySize.xcodeproj
into the file navigator of your app project.QuerySize.framework
matches that of the application target.QuerySize.framework
.+
button at the top left of the panel and select “New Copy Files Phase”. Rename this new phase to “Copy Frameworks”, set the “Destination” to “Frameworks”, and add QuerySize.framework
.import QuerySize
// ...
QuerySize(.ByIdiom(.Phone)) {
println("i am a phone")
}
QuerySize(.ByIdiom(.Pad)) {
println("i am a pad")
}
QuerySize(.ByIdiom(.Phone), .ByScreenMinWidth(321)) {
println("i am a phone at least 321pt wide")
}
QuerySize(.ByIdiom(.Phone), .ByScreenMaxWidth(320)) {
println("i am a phone at most 320pt wide")
}
QuerySize(.ByIdiom(.Phone), .ByScreenMaxWidth(320), .ByScreenMaxHeight(480)) {
println("i am a phone at most 320pt wide and 480pt high")
}
QuerySize(.ByIdiom(.Phone), .ByScreenMaxWidth(320), .ByScreenMinHeight(481)) {
println("i am a phone at most 320pt wide and at least 481pt high")
}