Skip to content

Instantly share code, notes, and snippets.

View Parietal's full-sized avatar

Brian Harper Parietal

  • Healthnexxus
  • Canada
View GitHub Profile
// 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
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>()
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)
@Parietal
Parietal / app.swift
Last active September 18, 2015 06:02 — forked from licvido/app.swift
SWIFT: Button with border
button.backgroundColor = UIColor.clearColor()
button.layer.cornerRadius = 5
button.layer.borderWidth = 1
button.layer.borderColor = UIColor.whiteColor().CGColor
@Parietal
Parietal / AppDelegate.swift
Last active July 5, 2018 03:42 — forked from chrishinds/AppDelegate.swift
Example in Swift of subclassing an ORKActiveStepViewController in Apple ResearchKit, then laying out a custom view
import UIKit
import ResearchKit
class DemoView: UIView {
}
class DemoStepViewController : ORKActiveStepViewController {
@Parietal
Parietal / app.swift
Last active August 29, 2015 14:25 — forked from licvido/app.swift
SWIFT: Fade when changing UIImageView's image
let toImage = UIImage(named:"image.png")
UIView.transitionWithView(self.imageView,
duration:5,
options: .TransitionCrossDissolve,
animations: { self.imageView.image = toImage },
completion: nil)
// 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
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()
/// 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> {
class Person {
var name = ""
var age = 0
init(name: String, age:Int) {
self.name = name
self.age = age
}
}