AspectScreen is a lightweight and pure Swift implemented component for calculating screen space points.
-
Add the following to your Podfile:
pod 'AspectScreen', '~> 0.1'
-
Integrate your dependencies using frameworks: add
use_frameworks!to your Podfile. -
Run
pod install.
let width = AspectScreen.partOfScreen(part: 0.5, type: .width)
let height = AspectScreen.partOfScreen(part: 0.5, type: .height)
let view = UIView(frame: CGRect(x: 0, y: 0, width: width, height: height))AspectScreen' author is Eugeny Popov.
AspectScreen is available under the MIT license. See the LICENSE file for more info.