Skip to content

Instantly share code, notes, and snippets.

@abarax
abarax / String.swift
Created December 2, 2015 04:22
String extensions for Swift
import Foundation
extension String
{
var length: Int {
get {
return self.characters.count
}
}
@dmrev
dmrev / SmartKey.swift
Last active December 11, 2015 18:28
Another statically-typed NSUserDefaults inspired by https://github.com/radex/SwiftyUserDefaults
class SmartKeyBase: Equatable, Hashable {
private let defaults = NSUserDefaults.standardUserDefaults()
private(set) static var allKeys = Set<SmartKeyBase>()
let name: String
static func removeAllValues() {
allKeys.forEach { $0.removeValue() }
}
init(_ name: String) {
@takecian
takecian / PushNotificationManager.swift
Last active November 13, 2015 13:45
Utility functions for iOS PushNotification
class PushNotificationManager {
class var isPushNotificationEnable: Bool {
let osVersion = UIDevice.currentDevice().systemVersion
if osVersion < "8.0" {
let types = UIApplication.sharedApplication().enabledRemoteNotificationTypes()
if types == UIRemoteNotificationType.None {
// push notification disabled
return false
}else{
// push notification enable
@leecade
leecade / 10.11_troubleshooting.md
Last active October 1, 2023 12:07
10.11_troubleshooting
@ohanhi
ohanhi / frp.md
Last active May 6, 2024 05:17
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@vertgo
vertgo / SwiftyJSON.swift
Created April 9, 2015 21:03
fixed swiftyjson, I think
// SwiftyJSON.swift
//
// Copyright (c) 2014 Ruoyu Fu, Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@yonat
yonat / Badge.swift
Last active December 22, 2022 09:40
Rounded UILabel and UIButton, Badged UIBarButtonItem
//
// Badge.swift
// Extensions for Rounded UILabel and UIButton, Badged UIBarButtonItem.
//
// Usage:
// let label = UILabel(badgeText: "Rounded Label");
// let button = UIButton(type: .System); button.rounded = true
// let barButton = UIBarButtonItem(badge: "42", title: "How Many Roads", target: self, action: "answer")
//
// Created by Yonat Sharon on 06.04.2015.
@natecook1000
natecook1000 / NSCalendar+Swift.swift
Created March 18, 2015 03:08
Swift-friendly NSCalendar methods
// NSCalendar+Swift.swift
// A set of Swift-idiomatic methods for NSCalendar
//
// (c) 2015 Nate Cook, licensed under the MIT license
extension NSCalendar {
/// Returns the hour, minute, second, and nanoseconds of a given date.
func getTimeFromDate(date: NSDate) -> (hour: Int, minute: Int, second: Int, nanosecond: Int) {
var (hour, minute, second, nanosecond) = (0, 0, 0, 0)
getHour(&hour, minute: &minute, second: &second, nanosecond: &nanosecond, fromDate: date)
@andykog
andykog / Alamofire.swift
Last active August 29, 2015 14:16
Alamofire without using dynamic libraries Xcode 6.3 compatible
// Alamofire.swift
//
// Copyright (c) 2014–2015 Alamofire (http://alamofire.org)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active June 17, 2024 06:08
The best FRP iOS resources.

Videos