Use the native Material UI/UX framework in Titanium!
This module project contains pure Swift libraries. A proof of concept includes an example of using the
RaisedButton
API. For more API's, submit a pull request to expose components likeBottomNavigationView
,Snackbar
orMotionAnimation
.
- Swift 4.1+ (embedded into the hook in
hooks/
), iOS 8+ - Titanium SDK 6.3.0+ (7.1.0+ recommended)
Creates a new raised button.
Creates a new text field.
Creates a new card view.
title
(String
)color
(String
)selectedColor
(String
)pulseColor
(String
)image
(String
)
contentView
(Ti.UI.View
)contentViewInsets
(Dictionary
)backgroundColor
(String
)cornerRadius
(Number
)
value
(String
)hintText
(String
)hintTextColor
(String
)font
(Dictionary
)
change
focus
blur
This project uses the following two Swift dependencies:
- Material
- Motion
This projects resolves all dependencies already for you, including setting the Swift version using the hook placed in hooks/
.
Right now, Titanium only supports CocoaPods for Hyperloop, so in order to use it for classic modules, you need
to create universal "fat" frameworks and strip the unused architectures again (this is taken care of by the SDK already).
A universal library can be created by grabbing the frameworks from Debug-iphonesimulator
(Simulator architectures)
and Debug-iphoneos
(Device architectures) and combine them using the following commands:
- Install CocoaPods (
sudo gem install cocoapods
) and runpod install
in thenative/
directory of this repository - Create the following folder structures:
sim/
,device/
&universal/
- Copy the .framework files from
Debug-iphonesimulator
tosim/
- Copy the .framework files from
Debug-iphoneos
todevice/
- Copy the .framework files from
device
touniversal/
(they are the base for universal frameworks) - Copy the
Modules/*.swiftmodule
to the universal directory of the framework - Use the following command to merge the sim- and device-frameworks together:
lipo -create -output universal/<name>.framework/<name> sim/<name>.framework/<name> device/<name>.framework/<name>
- Replace the final frameworks in
<module-project>/platform
- Make a pull request to this repo, so others can benefit from it as well
These steps are based on a Shell Script used natively.
Note: In the future, this will all be done by CocoaPods. Make sure to follow TIMOB-25927 regarding Swift support in the SDK.
var Material = require('ti.material');
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
var btn = Material.createRaisedButton({
width: 300,
height: 40,
title: 'Titanium rocks!'
});
btn.addEventListener('click', function() {
alert('YEY!');
});
win.add(btn);
win.open();
Hans Knöchel (@hansemannnn / Web)
MIT
Code contributions are greatly appreciated, please submit a new Pull-Request!