This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public extension Font { | |
init(uiFont: UIFont) { | |
self = Font(uiFont as CTFont) | |
} | |
static func expanded(_ style: UIFont.TextStyle, size: CGFloat? = nil, weight: Font.Weight = .regular) -> Font { | |
var descriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: style) | |
let traits: [UIFontDescriptor.TraitKey:Any] = [.width: 1.5] | |
descriptor = descriptor.addingAttributes([.traits: traits]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@objc func goHealth() { UIApplication.shared.open(URL(string: "x-apple-health://")!) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Weight.swift | |
// Vekt | |
// | |
// Created by Hidde van der Ploeg on 26/09/2016. | |
// Copyright © 2016 Hidde van der Ploeg. All rights reserved. | |
// | |
import UIKit | |
import HealthKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func imageURL(URL: String) -> UIImage { | |
guard let base = NSURL(string: URL), | |
let data = NSData(contentsOfURL: base), | |
let image = UIImage(data:data) else { | |
return nil | |
} | |
return image | |
} | |
//USAGE EXAMPLE: imagevar.image = imageURL("http://logonoid.com/images/star-wars-logo.png") |