API endpoint
Development: http://localhost:8181/api/v1
Production: http://usehamp.io/api/v1
// ============ IOS ============ | |
// 1. | |
public func messageReceived(message: Message) { | |
guard !message.isSentByMe() else {return} | |
var externalType:String? | |
var externalData: [AnyHashable: Any]? | |
if let externalMessageContent = message.content as? ExternalContent { | |
externalType = externalMessageContent.externalType | |
externalData = externalMessageContent.externalData | |
} |
import Foundation | |
fileprivate typealias WavByte = UInt8 | |
fileprivate typealias WavInt = UInt32 | |
fileprivate typealias WavShort = UInt16 | |
fileprivate struct WavConstants { | |
static let RIFF = [WavByte]("RIFF".utf8) | |
static let WAVE = [WavByte]("WAVE".utf8) | |
static let fmt = [WavByte]("fmt ".utf8) |
protocol Field { | |
var area: Float { get } | |
} | |
class RectangleField: Field { | |
var width: Float = 0 | |
var height: Float = 0 | |
var area: Float { | |
return width * height |
class RectangleField { | |
var width: Float = 0 | |
var height: Float = 0 | |
var area: Float { | |
return width * height | |
} | |
} |
class ContentController { | |
func show(_ type: Membership = .free) { | |
// Do stuff | |
switch type { | |
case .free: | |
// Show free content | |
case .subscriptor: | |
// Show subscriptor content | |
} |
class ContentController { | |
func show() { | |
// Do stuff | |
} | |
} | |
class SubscriptorContentController: ContentController { |
class Team { | |
var athletes: [Athlete] = ... | |
func reset() { | |
athletes.forEach{ $0.reset() } | |
} | |
} |
class Team { | |
var runners: [Runner] = ... | |
var riders: [Rider] = ... | |
var swimmers: [Swimmer] = ... | |
func reset() { | |
runners.forEach{ $0.reset() } | |
riders.forEach { $0.reset() } | |
swimmers.forEach { $0.reset() } |
class Team { | |
var runners: [Runner] = ... | |
var riders: [Rider] = ... | |
func reset() { | |
runners.forEach{ $0.reset() } | |
riders.forEach { $0.reset() } | |
} | |