Files
GitHawk/Classes/Repository/SegmentedControlModel+Repository.swift
2017-09-03 17:27:26 -04:00

28 lines
698 B
Swift

//
// SegmentedControlModel+Repository.swift
// Freetime
//
// Created by Sherlock, James on 29/07/2017.
// Copyright © 2017 Ryan Nystrom. All rights reserved.
//
import Foundation
extension SegmentedControlModel {
static func forRepository(_ hasIssuesEnabled: Bool) -> SegmentedControlModel {
var items = [NSLocalizedString("Pull Requests", comment: "")]
if hasIssuesEnabled {
items.insert(NSLocalizedString("Issues", comment: ""), at: 0)
}
return SegmentedControlModel(items: items)
}
var issuesSelected: Bool {
return items[selectedIndex] == NSLocalizedString("Issues", comment: "")
}
}