GithubHelp home page GithubHelp logo

rongcheng1992 / sizes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marcosgriselli/sizes

0.0 1.0 0.0 2.73 MB

View your app on different device and font sizes

License: MIT License

Ruby 19.93% Swift 80.07%

sizes's Introduction

Version Swift 4.1 iOS 10.0+ Cartage License Bitrise

Sizes reduces the time it takes to evaluate all of our apps possible device sizes, orientations and font combinations. With Sizes we'll avoid launching all the supported devices simulator, running our app and navigating through each screen manually which not only takes a lot of time but its also highly error prone since we sometimes forget to test one particular combination and we ship a screen with a layout bug to the App Store.

๐Ÿ“ฑ Sizes in action

Recorded on an 10.5 inch iPad Pro

๐ŸŒŸ Features

  • Inspect your app in multiple device sizes
  • Switch orientations
  • Test all font sizes
  • Universal (iPhone & iPad)

๐Ÿ’ก Demo

To run the demo project, clone the repo and run Sizes target.

๐Ÿ“ฒ Installation

Using CocoaPods

Edit your Podfile and specify the dependency:

pod 'Sizes'

Using Carthage

Edit your Cartfile and specify the dependency:

github 'marcosgriselli/Sizes'

๐Ÿ‘ฉโ€๐Ÿ’ป How to use

Preparations

Sizes require you to use Auto Layout in order to update the UI correctly with each change.

For font updates you'll need to use Dynamic Type.

Programmatically:

let label = UILabel()
label.font = UIFont.preferredFont(forTextStyle: .headline, compatibleWith: traitCollection)
label.adjustsFontForContentSizeCategory = true

IB/Storyboard:

Setup

I highly recommend you only use this while on #DEBUG mode.

The best way to setup Sizes is to use the SizesWindow as your AppDelegates' window. This will automatically make a SizesViewController instance contain your apps root view controller and you'll still be able to use code like UIApplication.shared.windows.first?.rootViewController as? YourInitialCustomViewController with no issues.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    #if DEBUG
        window = SizesWindow()
        window?.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()!
        window?.makeKeyAndVisible()
    #endif
    return true
}

Usage

Shake to display the Sizes configuration UI, then tap on one of the orientation/device options to trigger a change. Or update the Text size slider to navigate through the different font sizes, you'll get the font name as you slide. You can check a longer video implementation and some of the use cases of Sizes in this tweet

๐Ÿ›ฃ Roadmap

You can check the GitHub Project or Issues to get an overview of new features, fixes or releases planed.

โค๏ธ Contributing

This is an open source project, so feel free to contribute. How?

  • Open an issue.
  • Send feedback via twitter.
  • Propose your own fixes, suggestions and open a pull request with the changes.

See all contributors

๐Ÿ“ฃ Mentions

๐Ÿ‘จโ€๐Ÿ’ป Author

Marcos Griselli | @marcosgriselli

Twitter Follow

GitHub Follow

๐Ÿ›ก License

MIT License

Copyright (c) 2018 Marcos Griselli

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

sizes's People

Contributors

marcosgriselli avatar wacumov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.