Skip to content

Instantly share code, notes, and snippets.

View dalu93's full-sized avatar

Luca D'Alberti dalu93

  • MSD
  • Prague, Czech Republic
View GitHub Profile
protocol AudioPlayable {
var audioURL: URL { get }
}
extension SongClip: AudioPlayable {}
struct AudioPlayer {
func play<AudioItem: AudioPlayable>(_ item: AudioItem) {
// play the generic item
struct AudioPlayer {
func play(_ clip: SongClip) {
// play the audioURL property
}
}
extension SongClip: TwoLinesAndImageDisplayable {
var imageURL: URL { return coverImageURL }
var topLineText: String { return title }
var bottomLineText: String { return artist }
}
protocol TwoLinesAndImageDisplayable {
var imageURL: URL { get }
var topLineText: String { get }
var bottomLineText: String { get }
}
final class TwoLinesAndImageTableViewCell: UITableViewCell {
@IBOutlet fileprivate weak var _sideImageView: UIImageView!
@IBOutlet fileprivate weak var _topLabel: UILabel!
@IBOutlet fileprivate weak var _bottomLabel: UILabel!
final class SongClipTableViewCell: UITableViewCell {
@IBOutlet fileprivate weak var _coverImageView: UIImageView!
@IBOutlet fileprivate weak var _titleLabel: UILabel!
@IBOutlet fileprivate weak var _artistLabel: UILabel!
func set(_ clip: SongClip) {
_coverImageView.imageURL = clip.coverImageURL
_titleLabel.text = clip.title
_artistLabel.text = clip.artist
}
@dalu93
dalu93 / SongClip.swift
Last active March 14, 2017 12:21
SongClip declaration
struct SongClip {
let title: String
let artist: String
let audioURL: URL
let coverImageURL: URL
}
@dalu93
dalu93 / Fastfile
Last active October 1, 2021 15:22
Fastfile example
fastlane_version "1.49.0"
default_platform :ios
######################
slack_webhook = 'https://...' #See Slack Incoming Webhook
slack_default_channel = '#channel'
default_production_scheme = 'YOUR-PRODUCTION-SCHEME'
certificates_output_path = './certificates'
profiles_output_path = './profiles'