Giter VIP home page Giter VIP logo

pinkit's Introduction


    ____    _           _  __  _   _   
   |  _ \  (_)  _ __   | |/ / (_) | |_ 
   | |_) | | | | '_ \  | ' /  | | | __|
   |  __/  | | | | | | | . \  | | | |_ 
   |_|     |_| |_| |_| |_|\_\ |_|  \__|

PinKit is a super lightweight wrapper around vanilla auto layout for iOS that makes laying out constraints just like doing any other normal math. If you aren't a fan of overriding operators or learning new ones, then this isn't for you, but if you want to be able to write:


[myView.topAnchor |=| otherView.topAnchor + 10,\
myView.leadingAnchor |=| otherView.leadingAnchor + 8,\
myView.width |=| otherView.width/2 + 15,\
myView.height |>=| otherView.height * 0.3].activate()

then this is for you!

Q & A

Q: Do we really need another AutoLayout framework?
A: No! This isn't one either! It's just an easier way to use what Apple gives us.

Q: It's not working!
A: Make sure you are setting translatesAutoresizingMaskIntoConstraints to false on the view you are trying to constrain. Also try calling setNeedsLayout() andlayoutIfNeeded() on the containing view.

Q: It's crashing!
A: Your constraints are probably conflicting somehow. Look for messages in the console.

Q: OK, this is much easier for adding constraints, but how do I remove them?
A: use UIView.removeConstraints() just like you used to, or remove a whole array of constraints with .deactivate().

Q: What versions of Swift does PinKit work with?
A: It has been tested in Swift 4.1.2, and Swift 4.2, and may work in others.

Q: What do I have to do when apple renames all of the .constraint*SystemSpacing*() functions in Swift 4.2?
A: Nothing.🎉 I used conditional compilation flags to support both.

Q: Where are all of the blank XCTest files?
A: This was built and tested in an iPad playground. Well there wasn't much to test really, it's all just a bunch of syntactic sugar.

Q: Are you crazy?
A: Maybe a little🤷‍♂️

Q: Do you do this for a living?
A: Hopefully I will soon! You can buy my apps in the iOS AppStore to help!

Q: Are you using this in your apps?
A: Not yet, I prefer to use storyboards, but I use it in my playgrounds.

pinkit's People

Contributors

aaronkreipe 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.