Skip to content

Instantly share code, notes, and snippets.

View annjose's full-sized avatar

Ann Catherine Jose annjose

View GitHub Profile
@annjose
annjose / XcodePlaygroundUnitTests.swift
Last active December 21, 2022 08:24
Run unit tests inside Xcode playground
//: [Previous](@previous)
import XCTest
struct TodoItem {
let title: String
let dueBy: Date?
init(title: String) {
self.title = title
extension Notifications {
struct openUserProfile:NotificationType {
var userId:String
static var name: Notification.Name {
return Notification.Name(“LP_openUserProfile”)
}
var name:Notification.Name {
return openUserProfile.name
@annjose
annjose / CleanerSwiftCode.swift
Last active November 22, 2016 00:20
Code sample demonstrated in Rob Napier video on writing clean Swift code
// sample code for Rob Napier's video 'Swift Legacy Functional Programming' found in Realm News
// the article also explains how to use Swift to avoid bugs and write cleaner code
// URL: https://realm.io/news/tryswift-rob-napier-swift-legacy-functional-programming/
// ============ Use Enum for OR relationship; use Struct for AND relationship =======================
struct Credential {
let username: String
let password: String
}
@annjose
annjose / ProtocolExtensions-RayWenderlich-Sample.swift
Created November 22, 2016 00:11
Sample code for the article on Protocol Extensions at Ray Wenderlich
// Article Name: Introducing Protocol-Oriented Programming in Swift 2
// Article URL: https://www.raywenderlich.com/109156/introducing-protocol-oriented-programming-in-swift-2
protocol Flyable {
var speed: Double { get }
}
protocol Bird {
var name: String { get }
var canFly: Bool { get }
}
@annjose
annjose / build_install_mono_OSX
Created May 29, 2014 07:27
Build and Install Mono on OSX Smoothly
#!/bin/sh
##
# Consolidated script that compiles and installs Mono smoothly on Mac OS X.
# This script installs the dependencies (autoconf, automake, libtool), downloads Mono source and compiles it
# This script is originally from http://www.mono-project.com/Compiling_Mono_on_OSX
#
PREFIX=/usr/local