Skip to content

Instantly share code, notes, and snippets.

View mcfans's full-sized avatar
🏠
Working from home

mcfans

🏠
Working from home
View GitHub Profile
@T1T4N
T1T4N / CustomPlainButtonStyle.swift
Created September 19, 2019 13:41
A custom ButtonStyle that extends PlainButtonStyle functionality
struct CustomPlainButtonStyle: PrimitiveButtonStyle {
func makeBody(configuration: Self.Configuration) -> some View {
// reuse the original button action
Button(action: configuration.trigger, label: {
// configure the button label to our needs
configuration.label
.frame(width: 200, height: 200)
.foregroundColor(Color.red)
.background(Color.green)
})
@Arthraim
Arthraim / hairline.m
Last active October 29, 2018 07:40
Hairline of iOS
/**
* Width of hairline (1px on real device screen)
* The dppx of screens can be found here http://dpi.lv/
*
* @return CGFloat number to be set for "1px"
*/
+ (CGFloat)hairLineWidth {
if ([UIScreen mainScreen].bounds.size.width == 414.f) { // Plus
return 1.f / 2.46f; // 2.46 is the dppx of plus screens
} else {