
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
motion-pixate-layout
Advanced tools
This project adds a simple DSL to your Rubymotion UIViewControllers to create subviews to be styled with Pixate.
The idea is inspired by Teacup, which has an awesome layout/subview DSL for laying out your controllers. While this DSL is great, Teacup brings in a lot of style/stylesheet features that are not useful to Pixate users. MotionPixateLayout also adds a convenient shorthand selector to quickly set the styleId and styleClass of subviews.
class MyViewController < UIViewController
pixate_layout '#my-view.fancy' do
UILabel '#title-label.small.green', text: 'My Title'
UIButton '#ok-button.call-to-action'
UIView '#parent' do
UILabel '#child'
end
end
end
This code hooks into UIViewController's viewDidLoad
mode and:
view.styleId
to 'my-view'view.styleClass
to 'fancy'MotionPixateLayout adds a subviews
accessor to UIViewController that returns a hash of the controller's main view's subviews, where the keys are the styleId of the subview. To set the text of the title-label in the above example, we can access the subview by its id:
class MyViewController < UIViewController
# pixate_layout { ... }
def update_label_text
subviews['title-label'].text = 'An updated title'
end
end
Be aware that inside the pixate_layout block is instance_eval'ed in the context of a proxy object, so you can't call methods on or add instance variables to your controller there. MotionPixateLayout adds 2 lifecycle hooks, before_pixate_layout
and after_pixate_layout
that execute in the context of your controller instance before and after the layout block, respectively.
class MyViewController < UIViewController
pixate_layout do
@layout = true # Does not set an instance variable in controller
end
before_pixate_layout do
@layout = true # sets @layout instance variable in controller
end
after_pixate_layout do
@layout = true # sets @layout instance variable in controller
end
end
If you're using Bundler, just add gem 'motion-pixate-layout'
to your Gemfile, and bundle install
.
Make sure you've vendored the Pixate framework and set up motion-pixate.
I'd love some.
Are welcome. Please fork and submit a pull request with some specs.
FAQs
Unknown package
We found that motion-pixate-layout demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.