Skip to content

Instantly share code, notes, and snippets.

@shawwn
Created May 21, 2019 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawwn/bf50f3284fa6b079ca80d2661281c042 to your computer and use it in GitHub Desktop.
Save shawwn/bf50f3284fa6b079ca80d2661281c042 to your computer and use it in GitHub Desktop.
const SweetieKit = require('sweetiekit');
const {
CGRect,
UIButton,
} = SweetieKit;
async function make(demoVC) {
const w = demoVC.view.frame.width;
const button = new UIButton('👋 Hello Button', {x: 12, y: 80, width: w - 24, height: 50}, () => {
const alert = new UIAlertController(
'Button pressed',
'Hello',
);
const action = new UIAlertAction('Okay', () => {
alert.dismiss(true, () => {});
});
alert.addAction(action);
demoVC.present(alert, true, () => {});
});
button.backgroundColor = { red: 87/255, green: 174/255, blue: 176/255 };
button.layer.cornerRadius = 4;
button.layer.shadowRadius = 12;
button.layer.shadowColor = { red: 87/255, green: 174/255, blue: 176/255 };
button.layer.shadowOffset = { width: 0, height: 12 };
return button;
}
module.exports = make;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment