Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Learning SwiftUI

Yi D antonio081014

💭
Learning SwiftUI
View GitHub Profile
View ScrollViewController.swift
//
// ScrollViewController.swift
//
// Created by Antonio081014 on 3/6/18.
// Copyright © 2018 sample.com. All rights reserved.
//
import UIKit
@antonio081014
antonio081014 / Country.swift
Last active Feb 28, 2017 — forked from kharrison/Country.swift
Swift Hash Functions
View Country.swift
import Foundation
struct Country {
let name: String
let capital: String
var visited: Bool
}
extension Country: Equatable {
static func == (lhs: Country, rhs: Country) -> Bool {
@antonio081014
antonio081014 / Weekday.md
Last active Jan 31, 2017
This is a simple OptionSet Demo in swift.
View Weekday.md

This is a simple OptionSet Demo written in swift.

import UIKit

struct Weekday: OptionSet, CustomStringConvertible {
    let rawValue: Int
    
    /// Monday
    static let Monday = Weekday(rawValue: 1 << 2)
View SwiftProperty.swift
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground" {
//"Hello, playground"
willSet {
print("willSet \(str) : \(newValue)")
// "willSet Hello, playground : Hello, Antonio.\n"
str = "Hi"
@antonio081014
antonio081014 / ConstrainHelper.swift
Created Aug 23, 2016
Constrain Helper functions
View ConstrainHelper.swift
import UIKit
extension UIView {
public func constrainEqual(attribute: NSLayoutAttribute, to: AnyObject, multiplier: CGFloat = 1, constant: CGFloat = 0) {
constrainEqual(attribute, to: to, attribute, multiplier: multiplier, constant: constant)
}
public func constrainEqual(attribute: NSLayoutAttribute, to: AnyObject, _ toAttribute: NSLayoutAttribute, multiplier: CGFloat = 1, constant: CGFloat = 0) {
NSLayoutConstraint.activateConstraints([
NSLayoutConstraint(item: self, attribute: attribute, relatedBy: .Equal, toItem: to, attribute: toAttribute, multiplier: multiplier, constant: constant)
@antonio081014
antonio081014 / ViewController.m
Created Jun 5, 2016
Snippet of code on How to add Facebook Ads Banner to ViewController
View ViewController.m
//
// ViewController.m
//
// Created by Antonio081014 on 6/4/16.
// Copyright © 2016 Antonio081014.com. All rights reserved.
//
#import "ViewController.h"
@import FBAudienceNetwork;
@antonio081014
antonio081014 / BinaryTree.h
Last active Dec 3, 2015
Simple Task with Binary Tree written in Objective-C.
View BinaryTree.h
/**
* TreeNode:
* -val: NSNumber
* -left: TreeNode
* -right: TreeNode
*/
// Task: Build a Balanced Binary Search Tree from an Ordered Array.
- (TreeNode *)buildMinBSTFromArray:(NSArray *)array;
@antonio081014
antonio081014 / BinarySearch.h
Last active Dec 3, 2015
This is the Binary Search implementation written in Objective-C.
View BinarySearch.h
/**
* Standard Binary Search.
*/
- (BOOL)binarySearch:(NSInteger)number inArray:(NSArray *)array;
/**
* Find the very first element index in an ordered array that satisfy with crateria, then return the index.
* Otherwise, return -1.
* This algorithm implemented with binary search.
*/
@antonio081014
antonio081014 / MergeSort.h
Last active Dec 2, 2015
This is the Merge-Sort implementation written in Objective-C.
View MergeSort.h
/**
* Divide and Conque Algorithm.
*/
- (NSArray *)mergesort:(NSArray *)array
@antonio081014
antonio081014 / QuickSort.h
Last active Dec 2, 2015
This is the quicksort implementation written in Objective-C.
View QuickSort.h
- (NSArray *)quicksort:(NSArray *)array