Skip to content

Instantly share code, notes, and snippets.

View gokselkoksal's full-sized avatar

Göksel Köksal gokselkoksal

View GitHub Profile
protocol MovieListView: MovieListPresenterDelegate {
private var presenter: MovieListPresenter
func didTapOnReload()
func didTapOnMovie(at index: Int)
func showDetailView(for movie: Movie)
}
protocol MovieListPresenterDelegate {
func updateWithMoviePresentations(_ movies: [MoviePresentation])
}
protocol MovieListView: MovieListPresenterDelegate {
private var presenter: MovieListPresenter
func didTapOnReload()
func didTapOnMovie(at index: Int)
}
protocol MovieListPresenterDelegate {
func updateWithMoviePresentations(_ movies: [MoviePresentation])
}
enum Theme: String {
case light, dark
}
class UserSettings {
static let shared = UserSettings(notificationCenter: .default)
let notificationCenter: NotificationCenter
var theme: Theme = .light {
enum Theme: String {
case light, dark
}
protocol UserSettingsDelegate {
func themeDidChange(_ theme: Theme)
}
class UserSettings {
typealias Property<Value, ID> = GenericProperty<Value, ID, Void>
typealias CollectionProperty<Value, ID> = GenericProperty<Value, ID, CollectionChange>
struct GenericProperty<Value, ID, ChangeInfo> {
private var _value: Value
var value: Value {
get { return _value }
set { set(newValue) }
}
@gokselkoksal
gokselkoksal / ToggleFnKeys.scpt
Last active September 27, 2015 13:07
AppleScript to toggle Fn key (F1, F2, etc.) behaviour.
tell application "System Preferences"
set current pane to pane "com.apple.preference.keyboard"
tell application "System Events"
tell tab group 1 of window "Keyboard" of process "System Preferences"
click checkbox "Use all F1, F2, etc. keys as standard function keys"
end tell
end tell
end tell