mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-06-05 15:09:12 +08:00
28 lines
698 B
Swift
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: "")
|
|
}
|
|
|
|
}
|