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
// Author: SwiftUI-Lab (swiftui-lab.com) | |
// Description: a honeycomb eager grid | |
// blog article: https://swiftui-lab.com/eager-grids | |
import SwiftUI | |
struct Person { | |
let name: String | |
let image: String | |
var color: Color = .accentColor |
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
import SwiftUI | |
import Combine | |
extension UIScreen{ | |
static let screenWidth = UIScreen.main.bounds.size.width | |
static let screenHeight = UIScreen.main.bounds.size.height | |
static let screenSize = UIScreen.main.bounds.size | |
} | |
let lightUpProtocol = PassthroughSubject<(Int,Int),Never>() |
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
if refresh { | |
morpher.targets = [cubeGeometry2,cubeGeometry] | |
cubeNode.morpher = morpher | |
SCNTransaction.begin() | |
SCNTransaction.animationDuration = 4.0 | |
cubeNode.morpher?.setWeight(1.0, forTargetAt: 0) | |
SCNTransaction.completionBlock = { | |
newNode = SCNNode(geometry: cubeGeometry2) | |
cubeNode.removeFromParentNode() | |
coreNode.addChildNode(newNode) |
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
button.backgroundColor = UIColor.clearColor() | |
button.layer.cornerRadius = 5 | |
button.layer.borderWidth = 1 | |
button.layer.borderColor = UIColor.whiteColor().CGColor |
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
import UIKit | |
import ResearchKit | |
class DemoView: UIView { | |
} | |
class DemoStepViewController : ORKActiveStepViewController { |
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
let toImage = UIImage(named:"image.png") | |
UIView.transitionWithView(self.imageView, | |
duration:5, | |
options: .TransitionCrossDissolve, | |
animations: { self.imageView.image = toImage }, | |
completion: nil) |
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
// in viewDidLoad... | |
var tapGestureRecognizer = UITapGestureRecognizer(target: self, action: "showToolbars") | |
tapGestureRecognizer.cancelsTouchesInView = false | |
scrollView.addGestureRecognizer(tapGestureRecognizer) | |
// somewhere else... | |
func showToolbars() { | |
UIView.animateWithDuration(1.0, delay: 0.0, options: UIViewAnimationOptions.CurveEaseOut, animations: { | |
self.toolbar.frame = CGRectMake(0, self.view.frame.size.height-self.toolbar.frame.size.height, self.toolbar.frame.size.width, self.toolbar.frame.size.height) | |
if self.ios7Patches!.verticalSizeClass == UIUserInterfaceSizeClass.Compact { // iPhone Horizontal |
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
let plusButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: nil, action: nil) | |
var toolbarButtons = [plusButton]; | |
let toolbar = UIToolbar() | |
toolbar.sizeToFit() | |
toolbar.setItems(toolbarButtons, animated: true) | |
toolbar.backgroundColor = UIColor.whiteColor() |
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
/// An object that has some tear-down logic | |
public protocol Disposable { | |
func dispose() | |
} | |
/// An event provides a mechanism for raising notifications, together with some | |
/// associated data. Multiple function handlers can be added, with each being invoked, | |
/// with the event data, when the event is raised. | |
public class Event<T> { |
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
class Person { | |
var name = "" | |
var age = 0 | |
init(name: String, age:Int) { | |
self.name = name | |
self.age = age | |
} | |
} |
NewerOlder