{"id":18722828,"url":"https://github.com/qrush/motion-layout","last_synced_at":"2025-04-06T02:11:13.724Z","repository":{"id":7561162,"uuid":"8914766","full_name":"qrush/motion-layout","owner":"qrush","description":"A nice way to use iOS6+ autolayout in your RubyMotion app. Use ASCII-art inspired format strings to build your app's layout!","archived":false,"fork":false,"pushed_at":"2014-01-27T19:50:44.000Z","size":275,"stargazers_count":216,"open_issues_count":5,"forks_count":27,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-30T01:11:17.484Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qrush.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-20T21:24:15.000Z","updated_at":"2025-03-22T21:28:34.000Z","dependencies_parsed_at":"2022-09-01T18:44:27.303Z","dependency_job_id":null,"html_url":"https://github.com/qrush/motion-layout","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrush%2Fmotion-layout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrush%2Fmotion-layout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrush%2Fmotion-layout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrush%2Fmotion-layout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qrush","download_url":"https://codeload.github.com/qrush/motion-layout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423515,"owners_count":20936626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T13:43:05.865Z","updated_at":"2025-04-06T02:11:13.704Z","avatar_url":"https://github.com/qrush.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# motion-layout\n\nA nice way to use iOS6+ autolayout in your RubyMotion app. Use ASCII-art inspired format strings to build your app's layout!\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'motion-layout'\n\nAnd then execute:\n\n    bundle\n\nOr install it yourself as:\n\n    gem install motion-layout\n\nThen in your `Rakefile`:\n\n    require 'motion-layout'\n\n## Usage\n\nUsing AutoLayout is a way to put UI elements in your iPhone app without using Interface Builder, and without being very specific about pixel sizes, locations, etc. The layout strings are ASCII inspired, and Apple's documentation on the [Visual Format Language](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/VisualFormatLanguage/VisualFormatLanguage.html) is a necessary read and reference.\n\nHere's an example of `Motion::Layout` usage from inside of [Basecamp for iPhone](https://itunes.apple.com/us/app/id599139477) on a `UITableView`'s `tableFooterView`:\n\n![](https://raw.github.com/qrush/motion-layout/master/screenshot1.png)\n\n``` ruby\nMotion::Layout.new do |layout|\n  layout.view self.view.tableFooterView\n  layout.subviews \"switch\" =\u003e @switch, \"help\" =\u003e @help\n  layout.vertical \"|-15-[switch]-10-[help(==switch)]-15-|\"\n  layout.horizontal \"|-10-[switch]-10-|\"\n  layout.horizontal \"|-10-[help]-10-|\"\nend\n```\n\nAnd here's an example you can run right inside this repo, the Time app converted to use Auto Layout from the [RubyMotionSamples](https://github.com/HipByte/RubyMotionSamples) repo:\n\n![](https://raw.github.com/qrush/motion-layout/master/screenshot2.png)\n\n``` ruby\nMotion::Layout.new do |layout|\n  layout.view view\n  layout.subviews state: @state, action: @action\n  layout.metrics \"top\" =\u003e 200, \"margin\" =\u003e 20, \"height\" =\u003e 40\n  layout.vertical \"|-top-[state(==height)]-margin-[action(==height)]\"\n  layout.horizontal \"|-margin-[state]-margin-|\"\n  layout.horizontal \"|-margin-[action]-margin-|\"\nend\n```\n\n## TODO\n\n* Support finer grained constraints\n* Better debugging messages\n* More examples\n\n## Contributing\n\nI couldn't figure out how to test this automatically. Run `bundle` to get the gems you need, and then `rake` to generate a RubyMotion app in the iOS simulator\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## License\n\nMIT. See `LICENSE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqrush%2Fmotion-layout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqrush%2Fmotion-layout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqrush%2Fmotion-layout/lists"}