Giter Club home page Giter Club logo

ddhtweaks's Introduction

DDHTweaks

Tweak UI elements at runtime to find the perfect values

What is it?

Tweaks lets you make changes to your iOS app while it is running. This is especially useful if you are not sure about the right font size, colors or if you want to hide certain functionallities from some of your testers.

Installation

Add DDHTweaks.swift and DDHTweakUserInterface.swift to your project.

Usage

Tweak the font size of a label

DDHTweak.value(category: "Main View", collection: "Text", name: "Size", defaultValue: 20, min: 10, max: 40) { tweak in
  self.label.font = UIFont.systemFontOfSize(CGFloat(tweak.currentValue!))
}

Build and run the App. In the Simulator go to Hardware/Shake Gesture. Navigate to Main View and change the font size. Touch Done.

If you add an action to a tweak this is run when ever the value is changed.

Supported types for tweaks

  1. Float
  2. Double
  3. Bool
  4. String
  5. UIColor

Other examples

Tweaks without an action have to be run to update the value. This means these tweaks have to be defined in viewWillAppear() or viewDidAppear().

let textColor = Tweak.valueForCategory("Main View", collectionName: "Text", name: "Color", defaultValue: UIColor.blackColor())
label.textColor = textColor
        
let backgroundColor = Tweak.valueForCategory("Main View", collectionName: "Background", name: "Color", defaultValue: UIColor.whiteColor())
view.backgroundColor = backgroundColor
        
let text = Tweak.valueForCategory("Main View", collectionName: "Text", name: "Text", defaultValue: "Hello")
label.text = text

Author

Dominik Hauser

App.net: @dasdom

Twitter: @dasdom

swiftandpainless.com

Thanks

Thanks to facebook for the Objective-C version of Tweaks that I used as inspiration.

Licence

MIT Licence. See the LICENCE file for details.

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.