Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix Xcode version check to detect versions higher than 6.3 | import Foundation
let RequiredXcodeVersion = "Xcode 6.3"
func isRequiredXcodeIsInstalled() -> Bool {
return currentXcodeVersion() == RequiredXcodeVersion
}
func currentXcodeVersion() -> String? {
return run("xcodebuild -version").first
}
| import Foundation
let RequiredXcodeVersion = "Xcode 6.3"
func isRequiredXcodeIsInstalled() -> Bool {
if let comparationResult = currentXcodeVersion()?.localizedCaseInsensitiveCompare(RequiredXcodeVersion) {
switch comparationResult {
case .OrderedDescending, .OrderedSame: return true
... |
Revert "Using VC main view disposer as VC Disposer" | // Copyright © 2016 Compass. All rights reserved.
#if os(iOS) || os(tvOS)
import UIKit
#else
import Foundation
#endif
extension UIViewController {
public var disposer: Disposer {
return view.disposer
}
}
| // Copyright © 2016 Compass. All rights reserved.
#if os(iOS) || os(tvOS)
import UIKit
#else
import Foundation
#endif
extension UIViewController {
private static var disposerKey = "com.compass.Snail.UIViewController.disposer"
public var disposer: Disposer {
if let disposer = objc_getAssociatedObject... |
Remove ana (because nothing uses it). | // Copyright © 2015 Rob Rix. All rights reserved.
public protocol TermContainerType: Equatable, CustomDebugStringConvertible, CustomStringConvertible {
var out: Expression<Self> { get }
}
extension TermContainerType {
public static func out(container: Self) -> Expression<Self> {
return container.out
}
public ... | // Copyright © 2015 Rob Rix. All rights reserved.
public protocol TermContainerType: Equatable, CustomDebugStringConvertible, CustomStringConvertible {
var out: Expression<Self> { get }
}
extension TermContainerType {
public static func out(container: Self) -> Expression<Self> {
return container.out
}
public ... |
Use flat string in double bytes | public enum Tone: String {
case A
case Bb
case B
case C
case Db
case D
case Eb
case E
case F
case Gb
case G
case Ab
}
public extension Tone {
// Even though each tone is represented in String, we still need order of each tone.
public var order: Int {
swit... | public enum Tone: String {
case A
case Bb = "B♭"
case B
case C
case Db = "D♭"
case D
case Eb = "E♭"
case E
case F
case Gb = "G♭"
case G
case Ab = "A♭"
}
public extension Tone {
// Even though each tone is represented in String, we still need order of each tone.
p... |
Add values to the disjoint set. | // Copyright (c) 2015 Rob Rix. All rights reserved.
public struct DisjointSet {
public mutating func union(a: Int, b: Int) {
let (r1, r2) = (find(a), find(b))
let (n1, n2) = (sets[r1], sets[r2])
if r1 != r2 {
if n1.rank < n2.rank {
sets[r1].parent = r2
} else {
sets[r2].parent = r1
if n1.rank... | // Copyright (c) 2015 Rob Rix. All rights reserved.
public struct DisjointSet<T> {
public mutating func union(a: Int, b: Int) {
let (r1, r2) = (find(a), find(b))
let (n1, n2) = (sets[r1], sets[r2])
if r1 != r2 {
if n1.rank < n2.rank {
sets[r1].parent = r2
} else {
sets[r2].parent = r1
if n1.r... |
Use string for layout key | import UIKit
public protocol LayoutKey {
var layoutKey: String { get }
}
extension String: LayoutKey {
public var layoutKey: String { return self }
}
public class Layout {
private var constraints = [NSLayoutConstraint]()
private var sublayouts = [String : Layout]()
private var allConstraints: ... | import UIKit
public typealias LayoutKey = String
public class Layout {
private var constraints = [NSLayoutConstraint]()
private var sublayouts = [String : Layout]()
private var allConstraints: [NSLayoutConstraint] {
return constraints + sublayouts.values.flatMap({ $0.allConstraints })
}
... |
Update test scheme to use test server | //
// ApplicationController.swift
// TrolleyTracker
//
// Created by Austin on 3/22/17.
// Copyright © 2017 Code For Greenville. All rights reserved.
//
import Foundation
class ApplicationController {
let trolleyRouteService: TrolleyRouteService
let trolleyLocationService: TrolleyLocationService
let ... | //
// ApplicationController.swift
// TrolleyTracker
//
// Created by Austin on 3/22/17.
// Copyright © 2017 Code For Greenville. All rights reserved.
//
import Foundation
class ApplicationController {
let trolleyRouteService: TrolleyRouteService
let trolleyLocationService: TrolleyLocationService
let ... |
Add support for building package with Xcode 11 and SPM. | import PackageDescription
let package = Package(
name: "LoadableView"
)
| // swift-tools-version:5.0
//
// Package.swift
//
// Copyright © 2019 MLSDev Inc(https://mlsdev.com).
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including wi... |
Revert "Fixed missing animated GIF" | // swift-tools-version:5.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "DTFoundation",
platforms: [
.iOS(.v9), //.v8 - .v13
.macOS(.v10_10), //.v10_10 - .v10_15
.tvOS(... | // swift-tools-version:5.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "DTCoreText",
platforms: [
.iOS(.v9), //.v8 - .v13
.macOS(.v10_10), //.v10_10 - .v10_15
.tvOS(.v... |
Revert "add switch statement to handle mapping of wiki language to ISO language code" | // Created by Monte Hurd on 10/4/15.
// Copyright (c) 2015 Wikimedia Foundation. Provided under MIT-style license; please copy and modify!
import Foundation
extension NSLocale {
class func wmf_isCurrentLocaleEnglish() -> Bool {
guard let langCode = NSLocale.currentLocale().objectForKey(NSLocaleLanguageC... | // Created by Monte Hurd on 10/4/15.
// Copyright (c) 2015 Wikimedia Foundation. Provided under MIT-style license; please copy and modify!
import Foundation
extension NSLocale {
class func wmf_isCurrentLocaleEnglish() -> Bool {
guard let langCode = NSLocale.currentLocale().objectForKey(NSLocaleLanguageC... |
Upgrade dependencies, switch back to upstream BigInt package | // swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "SRP",
products: [
.library(name: "SRP", targets: ["SRP"]),
],
dependencies: [
.package(url: "https://github.com/IBM-Swift/BlueCryptor.git", from: "1.0.14"),
.package(url: "https://github.com/Boil... | // swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "SRP",
products: [
.library(name: "SRP", targets: ["SRP"]),
],
dependencies: [
.package(url: "https://github.com/IBM-Swift/BlueCryptor.git", from: "1.0.31"),
.package(url: "https://github.com/atta... |
Fix account header image alignment and foreground color | //
// AccountHeaderImageView.swift
// Multiplatform iOS
//
// Created by Rizwan on 08/07/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import SwiftUI
import RSCore
struct AccountHeaderImageView: View {
var image: RSImage
var body: some View {
HStack(alignment: .center) {
Image(rsImage... | //
// AccountHeaderImageView.swift
// Multiplatform iOS
//
// Created by Rizwan on 08/07/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import SwiftUI
import RSCore
struct AccountHeaderImageView: View {
var image: RSImage
var body: some View {
HStack(alignment: .center) {
Spacer()
I... |
Add small test for auth | //
// BiometricsAuthorizationServiceTests.swift
// iExtra
//
// Created by Saidi Daniel (BookBeat) on 2017-03-04.
// Copyright © 2017 Daniel Saidi. All rights reserved.
//
import Quick
import Nimble
import iExtra
class BiometricsAuthorizationServiceTests: QuickSpec {
override func spec() {
... | //
// BiometricsAuthorizationServiceTests.swift
// iExtra
//
// Created by Saidi Daniel (BookBeat) on 2017-03-04.
// Copyright © 2017 Daniel Saidi. All rights reserved.
//
import Quick
import Nimble
import iExtra
class BiometricsAuthorizationServiceTests: QuickSpec {
override func spec() {
... |
Change definition (var -> let) | //
// Context.swift
// Cmg
//
// Created by xxxAIRINxxx on 2016/02/20.
// Copyright © 2016 xxxAIRINxxx. All rights reserved.
//
import Foundation
import UIKit
import CoreImage
public final class Context {
public static var shared = Context()
public static var egleContext : EAGLContext { return C... | //
// Context.swift
// Cmg
//
// Created by xxxAIRINxxx on 2016/02/20.
// Copyright © 2016 xxxAIRINxxx. All rights reserved.
//
import Foundation
import UIKit
import CoreImage
public final class Context {
public static let shared = Context()
public static var egleContext : EAGLContext { return C... |
Use `NSDate` instead of `Date` | //
// VIMLive.swift
// Pods
//
// Created by Nguyen, Van on 8/29/17.
//
//
import Foundation
public enum LiveStreamingStatus: String
{
case unavailable = "unavailable"
case pending = "pending"
case ready = "ready"
case streamingPreview = "streaming_preview"
case streaming = "streaming"
case... | //
// VIMLive.swift
// Pods
//
// Created by Nguyen, Van on 8/29/17.
//
//
import Foundation
public enum LiveStreamingStatus: String
{
case unavailable = "unavailable"
case pending = "pending"
case ready = "ready"
case streamingPreview = "streaming_preview"
case streaming = "streaming"
case... |
Include first name and last name in credit card validation | //
// CreditCard.swift
// Spreedly
//
// Created by David Santoso on 10/8/15.
// Copyright © 2015 Spreedly Inc. All rights reserved.
//
import Foundation
public class CreditCard {
public var firstName, lastName, number, verificationValue, month, year: String?
public var address1, address2, city, state, zi... | //
// CreditCard.swift
// Spreedly
//
// Created by David Santoso on 10/8/15.
// Copyright © 2015 Spreedly Inc. All rights reserved.
//
import Foundation
public class CreditCard {
public var firstName, lastName, number, verificationValue, month, year: String?
public var address1, address2, city, state, zi... |
Cover JSONModelType with unit tests | //
// SwiftyJSONModelTests.swift
// SwiftyJSONModelTests
//
// Created by Oleksii on 17/09/16.
// Copyright © 2016 Oleksii Dykan. All rights reserved.
//
import XCTest
@testable import SwiftyJSONModel
class SwiftyJSONModelTests: XCTestCase {
override func setUp() {
super.setUp()
// Put se... | //
// SwiftyJSONModelTests.swift
// SwiftyJSONModelTests
//
// Created by Oleksii on 17/09/16.
// Copyright © 2016 Oleksii Dykan. All rights reserved.
//
import XCTest
import SwiftyJSON
@testable import SwiftyJSONModel
struct FullName {
let firstName: String
let lastName: String
}
extension FullName: JSO... |
Move protocol conformance to extensions | //
// AuthenticationData.swift
// HomeControl
//
// Created by Julian Grosshauser on 01/12/15.
// Copyright © 2015 Julian Grosshauser. All rights reserved.
//
import Locksmith
/// Contains all data necessary to authenticate a user at the server.
struct AuthenticationData: ReadableSecureStorable, CreateableSecureS... | //
// AuthenticationData.swift
// HomeControl
//
// Created by Julian Grosshauser on 01/12/15.
// Copyright © 2015 Julian Grosshauser. All rights reserved.
//
import Locksmith
/// Contains all data necessary to authenticate a user at the server.
struct AuthenticationData {
//MARK: Properties
/// Address... |
Update tests to run map() inside a closure. | func main() -> Int {
let names = ["foo", "patatino"]
var reversedNames = names.sorted(by: {
$0 > $1 } //%self.expect('p $0', substrs=['patatino'])
//%self.expect('p $1', substrs=['foo'])
//%self.expect('frame var $0', substrs=['patatino'])
//%self.expect('frame var $1'... | func main() -> Int {
let names = ["foo", "patatino"]
var reversedNames = names.sorted(by: {
$0 > $1 } //%self.expect('p $0', substrs=['patatino'])
//%self.expect('p $1', substrs=['foo'])
//%self.expect('frame var $0', substrs=['patatino'])
//%self.expect('frame var $1'... |
Hide bottom bar if only one item activated. | //
// YPBottomPagerView.swift
// YPImagePicker
//
// Created by Sacha DSO on 24/01/2018.
// Copyright © 2016 Yummypets. All rights reserved.
//
import UIKit
import Stevia
final class YPBottomPagerView: UIView {
var header = YPPagerMenu()
var scrollView = UIScrollView()
convenience init() {
... | //
// YPBottomPagerView.swift
// YPImagePicker
//
// Created by Sacha DSO on 24/01/2018.
// Copyright © 2016 Yummypets. All rights reserved.
//
import UIKit
import Stevia
final class YPBottomPagerView: UIView {
var header = YPPagerMenu()
var scrollView = UIScrollView()
convenience init() {
... |
Clear database if migration is required | //
// AppDelegate.swift
// Rocket.Chat
//
// Created by Rafael K. Streit on 7/5/16.
// Copyright © 2016 Rocket.Chat. All rights reserved.
//
import UIKit
import Fabric
import Crashlytics
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ a... | //
// AppDelegate.swift
// Rocket.Chat
//
// Created by Rafael K. Streit on 7/5/16.
// Copyright © 2016 Rocket.Chat. All rights reserved.
//
import UIKit
import Fabric
import Crashlytics
import RealmSwift
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
fu... |
Create a formatter for each call. | import Foundation
public final class Configuration {
public static var headersWithBoldTrait = false
static var defaultBoldFormatter: AttributeFormatter = {
if headersWithBoldTrait {
return BoldWithShadowForHeadingFormatter()
} else {
return BoldFormatter()
}
... | import Foundation
public final class Configuration {
public static var headersWithBoldTrait = false
static var defaultBoldFormatter: AttributeFormatter {
get {
if headersWithBoldTrait {
return BoldWithShadowForHeadingFormatter()
} else {
return ... |
Add associated types to protocol | import UIKit
protocol MMenuItemProtocol
{
var icon:UIImage { get }
var order:MMenu.Order { get }
init(order:MMenu.Order)
func controller(session:MSession) -> UIViewController
}
| import UIKit
protocol MMenuItemProtocol
{
associatedtype V:ViewMain
associatedtype M:Model<Self.V>
associatedtype C:Controller<Self.V, Self.M>
var icon:UIImage { get }
var order:MMenu.Order { get }
var controller:C.Type { get }
init(order:MMenu.Order)
}
|
Fix a typo in comment. | //
// Notification.swift
// ESOcean
//
// Created by Tomohiro Kumagai on H27/04/23.
//
//
import Foundation
// MARK: - Protocol
/// All native notifications need to confirm to the protocol.
public protocol Notification : NotificationProtocol, Postable {
}
/// All notifications (without NSNotification) need to c... | //
// Notification.swift
// ESOcean
//
// Created by Tomohiro Kumagai on H27/04/23.
//
//
import Foundation
// MARK: - Protocol
/// All native notifications need to confirm to the protocol.
public protocol Notification : NotificationProtocol, Postable {
}
/// All notifications (without NSNotification) need to c... |
Update Socket test to wait for socket shutdown | //
// UDPSocketTests.swift
// WIFIAV
//
// Created by Max Odnovolyk on 3/13/17.
// Copyright © 2017 Max Odnovolyk. All rights reserved.
//
import XCTest
@testable import WIFIAV
class UDPSocketTests: XCTestCase {
override func setUp() {
super.setUp()
continueAfterFailure = false
... | //
// UDPSocketTests.swift
// WIFIAV
//
// Created by Max Odnovolyk on 3/13/17.
// Copyright © 2017 Max Odnovolyk. All rights reserved.
//
import XCTest
@testable import WIFIAV
class UDPSocketTests: XCTestCase {
override func setUp() {
super.setUp()
continueAfterFailure = false
... |
Use let instead of var | struct Card {
var rank: Rank
var suit: Suit
}
extension Card: Equatable { }
func == (lhs: Card, rhs: Card) -> Bool {
return lhs.rank == rhs.rank && lhs.suit == rhs.suit
}
| struct Card {
let rank: Rank
let suit: Suit
}
extension Card: Equatable { }
func == (lhs: Card, rhs: Card) -> Bool {
return lhs.rank == rhs.rank && lhs.suit == rhs.suit
}
|
Test Unique handles Equatable Arrays. | // Copyright © 2017 Compass. All rights reserved.
import Foundation
import XCTest
@testable import Snail
class UniqueTests: XCTestCase {
func testVariableChanges() {
var events: [String?] = []
let subject = Unique<String?>(nil)
subject.asObservable().subscribe(
onNext: { strin... | // Copyright © 2017 Compass. All rights reserved.
import Foundation
import XCTest
@testable import Snail
class UniqueTests: XCTestCase {
func testVariableChanges() {
var events: [String?] = []
let subject = Unique<String?>(nil)
subject.asObservable().subscribe(
onNext: { strin... |
Use flatMap to avoid mutability | import Foundation
struct Cassette {
let name: String
let interactions: [Interaction]
init(name: String, interactions: [Interaction]) {
self.name = name
self.interactions = interactions
}
func interactionForRequest(request: NSURLRequest) -> Interaction? {
for interaction in... | import Foundation
struct Cassette {
let name: String
let interactions: [Interaction]
init(name: String, interactions: [Interaction]) {
self.name = name
self.interactions = interactions
}
func interactionForRequest(request: NSURLRequest) -> Interaction? {
for interaction in... |
Update test to use correct mode name | // Regression test for optimizations that might incorrectly execute function
// on wrong process.
// This test updated for merged engine/server
// Check that worker task doesn't run twice in same context
@dispatch=WORKER
(int o) worker_task (int i) "turbine" "0.0.1" [
"set <<o>> <<i>>; if { $turbine::mode != \"WORKE... | // Regression test for optimizations that might incorrectly execute function
// on wrong process.
// This test updated for merged engine/server
// Check that worker task doesn't run twice in same context
@dispatch=WORKER
(int o) worker_task (int i) "turbine" "0.0.1" [
"set <<o>> <<i>>; if { $turbine::mode != \"WORK\... |
Update default values for Menu Item | //
// Created by zen on 31/01/15.
// Copyright (c) 2015 Yalantis. All rights reserved.
//
import Foundation
import UIKit.UIImage
public struct MenuItem {
public var name: String?
public var image: UIImage
public var highlightedImage: UIImage?
public var backgroundColor = UIColor.blackColor()
... | //
// Created by zen on 31/01/15.
// Copyright (c) 2015 Yalantis. All rights reserved.
//
import Foundation
import UIKit.UIImage
public struct MenuItem {
public var name: String?
public var image: UIImage
public var highlightedImage: UIImage?
public var backgroundColor = UIColor(red: 50.0 / 255.... |
Initialize `HabitsController` with view model | //
// AppDelegate.swift
// Habits
//
// Created by Julian Grosshauser on 26/09/15.
// Copyright © 2015 Julian Grosshauser. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow? = {
let window = UIWindow(frame: UIScreen.mai... | //
// AppDelegate.swift
// Habits
//
// Created by Julian Grosshauser on 26/09/15.
// Copyright © 2015 Julian Grosshauser. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow? = {
let window = UIWindow(frame: UIScreen.mai... |
Revert "Rename news jsonNode photoUrl to imageUrl" | //
// NewsMapper.swift
// TOZ_iOS
//
// Copyright © 2017 intive. All rights reserved.
//
import Foundation
final class NewsResponseMapper: ArrayResponseMapper<NewsItem>, ResponseMapperProtocol {
static func process(_ obj: AnyObject?) throws -> [NewsItem] {
return try process(obj, mapper: { jsonNode in... | //
// NewsMapper.swift
// TOZ_iOS
//
// Copyright © 2017 intive. All rights reserved.
//
import Foundation
final class NewsResponseMapper: ArrayResponseMapper<NewsItem>, ResponseMapperProtocol {
static func process(_ obj: AnyObject?) throws -> [NewsItem] {
return try process(obj, mapper: { jsonNode in... |
Change glob to return files |
#include <builtins.swift>
#include <io.swift>
#include <files.swift>
#include <sys.swift>
//usage: stc 563-glob.swift -S=/home/zzhang/*.swift
main
{
string s[];
s = glob(argv("S"));
foreach f in s
{
printf("file: %s", f);
}
}
|
#include <builtins.swift>
#include <io.swift>
#include <files.swift>
#include <sys.swift>
//usage: stc 563-glob.swift -S=/home/zzhang/*.swift
main
{
file s[];
s = glob(argv("S"));
foreach f in s
{
printf("file: %s", filename(f));
}
}
|
Add a MARK to an extension of UINavigationBar | //
// UINavigationBar+Colors.swift
// RGUIExtension
//
// Created by RAIN on 15/11/30.
// Copyright © 2015年 Smartech. All rights reserved.
//
import UIKit
extension UINavigationBar {
/**
修改 Navigation Bar 的背景颜色
- parameter color: 提供给 Navigation Bar 的背景的 tint color
*/
static func barTi... | //
// UINavigationBar+Colors.swift
// RGUIExtension
//
// Created by RAIN on 15/11/30.
// Copyright © 2015年 Smartech. All rights reserved.
//
import UIKit
// MARK: Colors
extension UINavigationBar {
/**
修改 Navigation Bar 的背景颜色
- parameter color: 提供给 Navigation Bar 的背景的 tint color
*/
... |
Break the Maybe declaration out into a temporary. | // Copyright © 2015 Rob Rix. All rights reserved.
extension Module {
public static var maybe: Module {
return Module("Maybe", [
Declaration.Datatype("Maybe", .Argument(.Type, {
[
"just": .Argument($0, const(.End)),
"nothing": .End
]
}))
])
}
}
import Prelude
| // Copyright © 2015 Rob Rix. All rights reserved.
extension Module {
public static var maybe: Module {
let Maybe = Declaration.Datatype("Maybe", .Argument(.Type, {
[
"just": .Argument($0, const(.End)),
"nothing": .End
]
}))
return Module("Maybe", [ Maybe ])
}
}
import Prelude
|
Add extra variadic generic test | // RUN: %target-typecheck-verify-swift -enable-experimental-variadic-generics
protocol P {}
protocol P1 {
associatedtype A... // expected-error {{associated types cannot be variadic}}
associatedtype B<U>...
// expected-error@-1 {{associated types cannot be variadic}}
// expected-error@-2 {{associated types mu... | // RUN: %target-typecheck-verify-swift -enable-experimental-variadic-generics
protocol P {}
protocol P1 {
associatedtype A... // expected-error {{associated types cannot be variadic}}
associatedtype B<U>...
// expected-error@-1 {{associated types cannot be variadic}}
// expected-error@-2 {{associated types mu... |
Remove modifiedTime property. Add migrated property. | //
// SubscriptionCollection.swift
// Pods
//
// Created by Lim, Jennifer on 1/20/17.
//
//
/// Represents all the subscriptions with extra informations
public class SubscriptionCollection: VIMModelObject
{
// MARK: - Properties
/// Represents the uri
public var uri: String?
/// Represents the... | //
// SubscriptionCollection.swift
// Pods
//
// Created by Lim, Jennifer on 1/20/17.
//
//
/// Represents all the subscriptions with extra informations
public class SubscriptionCollection: VIMModelObject
{
// MARK: - Properties
/// Represents the uri
public var uri: String?
/// Represents the... |
Augment Test for Confusing ExpressibleByNilLiteral Case | // RUN: %target-typecheck-verify-swift
enum Hey {
case listen
}
func test() {
switch Hey.listen {
case nil: // expected-warning {{type 'Hey' is not optional, value can never be nil}}
break
default:
break
}
}
| // RUN: %target-typecheck-verify-swift
enum Hey {
case listen
}
func test() {
switch Hey.listen {
case nil: // expected-warning {{type 'Hey' is not optional, value can never be nil}}
break
default:
break
}
}
struct Nilable: ExpressibleByNilLiteral {
init(nilLiteral: ()) {}
}
func testNil() {
/... |
Fix mahjong face image in keyboard. | //
// MahjongFaceCell.swift
// Stage1st
//
// Created by Zheng Li on 2018/10/1.
// Copyright © 2018 Renaissance. All rights reserved.
//
import Alamofire
import Kingfisher
final class MahjongFaceCell: UICollectionViewCell {
let imageView = UIImageView(frame: .zero)
static let placeholderImage = UIImage(n... | //
// MahjongFaceCell.swift
// Stage1st
//
// Created by Zheng Li on 2018/10/1.
// Copyright © 2018 Renaissance. All rights reserved.
//
import Alamofire
import Kingfisher
final class MahjongFaceCell: UICollectionViewCell {
let imageView = UIImageView(frame: .zero)
static let placeholderImage = UIImage(n... |
Configure the job list to take in views | //
// JobList.swift
// JenkinsiOS
//
// Created by Robert on 23.09.16.
// Copyright © 2016 MobiLab Solutions. All rights reserved.
//
import Foundation
class JobList: CustomStringConvertible{
var jobs: [Job] = []
init(data: Any) throws{
guard let json = data as? [String: AnyObject]
... | //
// JobList.swift
// JenkinsiOS
//
// Created by Robert on 23.09.16.
// Copyright © 2016 MobiLab Solutions. All rights reserved.
//
import Foundation
class JobList: CustomStringConvertible{
var jobs: [Job] = []
var views: [View]?
//FIXME: Init with different tree
init(data: Any) throws... |
Add explicit target to package manifest | // swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "StringScanner"
)
| // swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "StringScanner",
targets: [
.target(
name: "StringScanner",
path: "Sources")
]
)
|
Correct the set of free variables in annotated terms. | // Copyright © 2015 Rob Rix. All rights reserved.
public enum AnnotatedTerm<Annotation>: TermContainerType {
indirect case Unroll(Annotation, Scoping<AnnotatedTerm>)
public var annotation: Annotation {
get {
return destructure.0
}
set {
self = .Unroll(newValue, out)
}
}
public var destructure: (An... | // Copyright © 2015 Rob Rix. All rights reserved.
public enum AnnotatedTerm<Annotation>: TermContainerType {
indirect case Unroll(Annotation, Scoping<AnnotatedTerm>)
public var annotation: Annotation {
get {
return destructure.0
}
set {
self = .Unroll(newValue, out)
}
}
public var destructure: (An... |
Use NSURLSession instead of NSURLConnection | import UIKit
import DATAStack
import Sync
class Networking {
let AppNetURL = "https://api.app.net/posts/stream/global"
let dataStack: DATAStack
required init(dataStack: DATAStack) {
self.dataStack = dataStack
}
func fetchItems(completion: (NSError?) -> Void) {
if let urlAppNet = ... | import UIKit
import DATAStack
import Sync
class Networking {
let AppNetURL = "https://api.app.net/posts/stream/global"
let dataStack: DATAStack
required init(dataStack: DATAStack) {
self.dataStack = dataStack
}
func fetchItems(completion: (NSError?) -> Void) {
let session = NSURLS... |
Build a type constructor directly. | // Copyright © 2015 Rob Rix. All rights reserved.
extension Expression where Recur: TermType {
public static var list: Module<Recur> {
return Module([
Declaration.Data("List", .Type, {
[
"nil": .End,
"cons": .Argument($0, const(.Recursive(.End)))
]
})
])
}
}
import Prelude
| // Copyright © 2015 Rob Rix. All rights reserved.
extension Expression where Recur: TermType {
public static var list: Module<Recur> {
return Module([
Declaration.Datatype("List", .Argument(.Type, {
.End([
"nil": .End,
"cons": .Argument($0, const(.Recursive(.End)))
])
}))
])
}
}
import... |
Switch from rxwei/Parsey to kyouko-taiga/Parsey. | // swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "LogicKit",
products: [
.library(name: "LogicKit", type: .static, targets: ["LogicKit"]),
.executable(name: "lki", targets: ["lki"]),
],
dependencies: [
.package(url: "https://github.com/rxwei/Par... | // swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "LogicKit",
products: [
.library(name: "LogicKit", type: .static, targets: ["LogicKit"]),
.executable(name: "lki", targets: ["lki"]),
],
dependencies: [
.package(url: "https://github.com/kyouko-ta... |
Add utility class for test calendars | //
// TimeUnitTestsUtilities.swift
// Tunits
//
// Created by Tom on 12/27/15.
// Copyright © 2015 CocoaPods. All rights reserved.
//
import Foundation
| //
// TimeUnitTestsUtilities.swift
// Tunits
//
// Created by Tom on 12/27/15.
// Copyright © 2015 CocoaPods. All rights reserved.
//
import Foundation
import Tunits
public class TimeUnitTestsUtilities : NSObject {
public enum Weekday : Int {
case Sunday = 1
case Monday = 2
case Tuesda... |
Add a little animation on large button press | import UIKit
@IBDesignable
class RoundedCornerButton: UIButton {
@IBInspectable
var cornerRadius: CGFloat = 0 {
didSet {
layer.cornerRadius = cornerRadius
}
}
override var intrinsicContentSize: CGSize {
return CGSize(width: UIView.noIntrinsicMetric, height: 45)
... | import UIKit
@IBDesignable
class RoundedCornerButton: UIButton {
@IBInspectable
var cornerRadius: CGFloat = 0 {
didSet {
layer.cornerRadius = cornerRadius
}
}
override var intrinsicContentSize: CGSize {
return CGSize(width: UIView.noIntrinsicMetric, height: 45)
... |
Remove deprecated use of Range(start:end:) | //
// StringExtensions.swift
// BlueCap
//
// Created by Troy Stribling on 6/29/14.
// Copyright (c) 2014 Troy Stribling. The MIT License (MIT).
//
import Foundation
public extension String {
public var floatValue : Float {
return (self as NSString).floatValue
}
public func dataFromH... | //
// StringExtensions.swift
// BlueCap
//
// Created by Troy Stribling on 6/29/14.
// Copyright (c) 2014 Troy Stribling. The MIT License (MIT).
//
import Foundation
public extension String {
public var floatValue : Float {
return (self as NSString).floatValue
}
public func dataFromH... |
Revert "[test] Remove copy-pasted XFAIL line" | // RUN: %target-swift-ide-test -syntax-coloring -source-filename %s | %FileCheck %s
// RUN: %target-swift-ide-test -syntax-coloring -typecheck -source-filename %s | %FileCheck %s
// CHECK: <kw>let</kw> x = <str>"""
// CHECK-NEXT: This is an unterminated
// CHECK-NEXT: \( "multiline" )
// CHECK-NEXT: string followed by... | // RUN: %target-swift-ide-test -syntax-coloring -source-filename %s | %FileCheck %s
// RUN: %target-swift-ide-test -syntax-coloring -typecheck -source-filename %s | %FileCheck %s
// XFAIL: broken_std_regex
// CHECK: <kw>let</kw> x = <str>"""
// CHECK-NEXT: This is an unterminated
// CHECK-NEXT: \( "multiline" )
// CHE... |
Remove implicit animation on selecting row | import SwiftUI
struct SelectableRow<ID, Label>: View where ID: Identifiable, Label: View {
var tag: ID?
@Binding var selection: ID?
var content: () -> Label
var body: some View {
Button {
withAnimation {
selection = tag
}
} label: {
... | import SwiftUI
struct SelectableRow<ID, Label>: View where ID: Identifiable, Label: View {
var tag: ID?
@Binding var selection: ID?
var content: () -> Label
var body: some View {
Button {
selection = tag
} label: {
HStack {
content()
... |
Make sure a test that has never run on any platform continues to never run on any platforms. | // RUN: rm -rf %t
// RUN: mkdir %t
// RUN: %swift -target x86_64-unknown-linux-gnu -emit-module -parse-stdlib -o %t -module-name Empty -module-link-name swiftEmpty %S/../Inputs/empty.swift
// RUN: %swift -target x86_64-unknown-linux-gnu %s -I %t -parse-stdlib -disable-objc-interop -module-name main -emit-ir -o - | File... | // RUN: rm -rf %t
// RUN: mkdir %t
// RUN: %swift -target x86_64-unknown-linux-gnu -emit-module -parse-stdlib -o %t -module-name Empty -module-link-name swiftEmpty %S/../Inputs/empty.swift
// RUN: %swift -target x86_64-unknown-linux-gnu %s -I %t -parse-stdlib -disable-objc-interop -module-name main -emit-ir -o - | File... |
Make 'satisfy' parser, have 'any' and 'token' use it. | //
// Parser.swift
// FootlessParser
//
// Released under the MIT License (MIT), http://opensource.org/licenses/MIT
//
// Copyright (c) 2015 NotTooBad Software. All rights reserved.
//
import Result
import Runes
// TODO: Implement ParserError
public typealias ParserError = String
public struct Parser <Token, Output>... | //
// Parser.swift
// FootlessParser
//
// Released under the MIT License (MIT), http://opensource.org/licenses/MIT
//
// Copyright (c) 2015 NotTooBad Software. All rights reserved.
//
import Result
import Runes
// TODO: Implement ParserError
public typealias ParserError = String
public struct Parser <Token, Output>... |
Add some logging so we can see when requests are made | //
// FetchIssuesOperation.swift
// FiveCalls
//
// Created by Ben Scheirman on 1/31/17.
// Copyright © 2017 5calls. All rights reserved.
//
import Foundation
class FetchIssuesOperation : BaseOperation {
let zipCode: String?
var httpResponse: HTTPURLResponse?
var error: Error?
var issue... | //
// FetchIssuesOperation.swift
// FiveCalls
//
// Created by Ben Scheirman on 1/31/17.
// Copyright © 2017 5calls. All rights reserved.
//
import Foundation
class FetchIssuesOperation : BaseOperation {
let zipCode: String?
var httpResponse: HTTPURLResponse?
var error: Error?
var issue... |
Add a definitions-only module constructor. | // Copyright © 2015 Rob Rix. All rights reserved.
public struct Module<Recur> {
public typealias Environment = Expression<Recur>.Environment
public typealias Context = Expression<Recur>.Context
public init<D: SequenceType, S: SequenceType where D.Generator.Element == Module, S.Generator.Element == Binding<Recur>>... | // Copyright © 2015 Rob Rix. All rights reserved.
public struct Module<Recur> {
public typealias Environment = Expression<Recur>.Environment
public typealias Context = Expression<Recur>.Context
public init<D: SequenceType, S: SequenceType where D.Generator.Element == Module, S.Generator.Element == Binding<Recur>>... |
Fix issue with scroll inset for hidden nav bar | //
// DezignableHiddenNavigationBar.swift
// Pods
//
// Created by Daniel van Hoesel on 02-03-16.
//
//
import UIKit
public protocol DezignableHiddenNavigationBar {
var navigationBarHidden: Bool { get set }
}
public extension DezignableHiddenNavigationBar where Self: UIViewController {
public func setupHidden... | //
// DezignableHiddenNavigationBar.swift
// Pods
//
// Created by Daniel van Hoesel on 02-03-16.
//
//
import UIKit
public protocol DezignableHiddenNavigationBar {
var navigationBarHidden: Bool { get set }
}
public extension DezignableHiddenNavigationBar where Self: UIViewController {
public func setupHidden... |
Use a function for one of the fixtures. | // Copyright (c) 2015 Rob Rix. All rights reserved.
final class SubstitutionTests: XCTestCase {
let (a, b) = (Variable(), Variable())
let (c, d) = (Variable(), Variable())
var t1: Type { return Type(c) }
var t2: Type { return Type(d) }
func testCompositionIsIdempotentIfOperandsAreIdempotent() {
let s1 = Subst... | // Copyright (c) 2015 Rob Rix. All rights reserved.
final class SubstitutionTests: XCTestCase {
let (a, b) = (Variable(), Variable())
let (c, d) = (Variable(), Variable())
var t1: Type { return Type(c) }
var t2: Type { return Type(function: Type(d), Type(d)) }
func testCompositionIsIdempotentIfOperandsAreIdempo... |
Allow TortoiseCharmer to use default value on initialization to prevent run-time crash | import CoreGraphics
public class GraphicsCanvas: Canvas {
private var tortoiseCharmer = TortoiseCharmer(tortoiseCount: 0)
private let graphicsContext: GraphicsContext
public init(size: CGSize, context: CGContext) {
#if os(iOS)
let isUIViewContext = true
#else
let i... | import CoreGraphics
public class GraphicsCanvas: Canvas {
private var tortoiseCharmer = TortoiseCharmer()
private let graphicsContext: GraphicsContext
public init(size: CGSize, context: CGContext) {
#if os(iOS)
let isUIViewContext = true
#else
let isUIViewContext =... |
Fix typo in NSBundle path | import Foundation
extension Bundle {
@objc public class var aztecBundle: Bundle {
let defaultBundle = Bundle(for: EditorView.self)
// If installed with CocoaPods, resources will be in WordPress-Aztec-iOS.bundle
if let bundleURL = defaultBundle.resourceURL,
let resourceBundle = B... | import Foundation
extension Bundle {
@objc public class var aztecBundle: Bundle {
let defaultBundle = Bundle(for: EditorView.self)
// If installed with CocoaPods, resources will be in WordPress-Aztec-iOS.bundle
if let bundleURL = defaultBundle.resourceURL,
let resourceBundle = B... |
Fix license in Swift+Path file | //
// String+Path.swift
// MobileLocalizationConverter
//
// Created by Sébastien Duperron on 23/05/2016.
// Copyright © 2016 Sébastien Duperron. All rights reserved.
//
import Foundation
extension String {
func appending(pathComponent component: String) -> String {
return (self as NSString).stringByA... | //
// String+Path.swift
//
// Created by Sébastien Duperron on 23/05/2016.
// Copyright © 2016 Sébastien Duperron
// Released under an MIT license: http://opensource.org/licenses/MIT
//
import Foundation
extension String {
func appending(pathComponent component: String) -> String {
return (self as NSS... |
Correct the order of System Font Weights. | import Foundation
public enum SystemFontWeight: String {
public static let allValues: [SystemFontWeight] = [
.ultralight, .thin, .light, .regular, .medium, .semibold, .bold, .heavy, .black
]
case ultralight
case thin
case light
case regular
case medium
case semibold
case bo... | import Foundation
public enum SystemFontWeight: String {
public static let allValues: [SystemFontWeight] = [
.thin, .ultralight, .light, .regular, .medium, .semibold, .bold, .heavy, .black
]
case ultralight
case thin
case light
case regular
case medium
case semibold
case bo... |
Add enum special case for ';' test | import Foundation;
println("Hello, World!")
// Class examples
class lowerCamelCase {
var x: String = "hello";
let b = 2;
func demo()
{
for var x = 0; ; {
print(x);
};
if temperatureInFahrenheit <= 32 {
println("It's very cold. Consider wearing a scarf... | import Foundation;
println("Hello, World!")
enum CompassPoint {
case North;
case South;
case East;
case West;
};
// Class examples
class lowerCamelCase {
var x: String = "hello";
let b = 2;
func demo()
{
for var x = 0; ; {
print(x);
};
if tempera... |
Expand the Branches/Type test out a little. | // Copyright © 2015 Rob Rix. All rights reserved.
final class TagTests: XCTestCase {
func testTagTypechecksAsFunction() {
let expected = Expression.FunctionType([ Enumeration, Term(.Type(0)) ])
let actual = Tag.out.checkType(expected, context: context)
assert(actual.left, ==, nil)
assert(actual.right, ==, ex... | // Copyright © 2015 Rob Rix. All rights reserved.
final class TagTests: XCTestCase {
func testTagTypechecksAsFunction() {
let expected = Expression.FunctionType([ Enumeration, Term(.Type(0)) ])
let actual = Tag.out.checkType(expected, context: context)
assert(actual.left, ==, nil)
assert(actual.right, ==, ex... |
Hide Next / Previous button by default | //
// SwiftRadio-Settings.swift
// Swift Radio
//
// Created by Matthew Fecher on 7/2/15.
// Copyright (c) 2015 MatthewFecher.com. All rights reserved.
//
import Foundation
//**************************************
// GENERAL SETTINGS
//**************************************
// Display Comments
let kDebugLog = tr... | //
// SwiftRadio-Settings.swift
// Swift Radio
//
// Created by Matthew Fecher on 7/2/15.
// Copyright (c) 2015 MatthewFecher.com. All rights reserved.
//
import Foundation
//**************************************
// GENERAL SETTINGS
//**************************************
// Display Comments
let kDebugLog = tr... |
Disable throttle in debug mode | #if os(iOS)
import UIKit
#endif
public class NetworkActivityIndicator {
/**
The shared instance.
*/
public static let sharedIndicator = NetworkActivityIndicator()
/**
The number of activities in progress.
*/
internal var activitiesCount = 0
/**
A Boolean value that t... | #if os(iOS)
import UIKit
#endif
public class NetworkActivityIndicator {
/**
The shared instance.
*/
public static let sharedIndicator = NetworkActivityIndicator()
/**
The number of activities in progress.
*/
internal var activitiesCount = 0
/**
A Boolean value that t... |
Revert "Updated for Swift 4" | // swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "LittleCMS",
products: [
// Products define the executables and libraries produced by a package, and make them visible to o... | // swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "LittleCMS",
products: [
// Products define the executables and libraries produced by a package, and make them visible to o... |
Remove the default implementation of _ObjectiveCBridgeable._unconditionallyBridgeFromObjectiveC. | //===--- NSValue.swift - Bridging things in NSValue -----------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LI... | //===--- NSValue.swift - Bridging things in NSValue -----------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LI... |
Add a PathContaining protocol for expanding paths to the source file's directory | import Foundation
import JSONUtilities
import PathKit
import Yams
extension Project {
public init(path: Path) throws {
let basePath = path.parent()
let template = try Spec(filename: path.lastComponent, basePath: basePath)
try self.init(spec: template, basePath: basePath)
}
}
| import Foundation
import JSONUtilities
import PathKit
import Yams
extension Project {
public init(path: Path) throws {
let basePath = path.parent()
let template = try Spec(filename: path.lastComponent, basePath: basePath)
try self.init(spec: template, basePath: basePath)
}
}
proto... |
Define standard implementation of the Orderable protocol | //
// Ordinable+FirebaseModel.swift
// FireRecord
//
// Created by Victor Alisson on 25/09/17.
//
import FirebaseCommunity
extension Orderable where Self: FirebaseModel {
public static func order(byProperty property: String) -> Self.Type {
Self.fireRecordReference = Self.classPath.queryOrdered(byChild:... | //
// Ordinable+FirebaseModel.swift
// FireRecord
//
// Created by Victor Alisson on 25/09/17.
//
import FirebaseCommunity
extension Orderable where Self: FirebaseModel {
public static func order(byProperty property: String) -> Self.Type {
Self.fireRecordQuery = Self.classPath.queryOrdered(byChild: pro... |
Fix warning about discarding result | //
// ViewController.swift
// ELReachabilityExample
//
// Created by Sam Grover on 8/13/15.
// Copyright © 2015 WalmartLabs. All rights reserved.
//
import UIKit
import ELReachability
class ViewController: UIViewController {
let theInternets: NetworkStatus?
required init?(coder aDecoder: NSCoder) {
... | //
// ViewController.swift
// ELReachabilityExample
//
// Created by Sam Grover on 8/13/15.
// Copyright © 2015 WalmartLabs. All rights reserved.
//
import UIKit
import ELReachability
class ViewController: UIViewController {
let theInternets: NetworkStatus?
required init?(coder aDecoder: NSCoder) {
... |
Implement `type` in terms of `destructure`. | // Copyright © 2015 Rob Rix. All rights reserved.
public enum Elaborated<Term: TermType>: TermContainerType {
indirect case Unroll(Term, Expression<Elaborated>)
/// Construct an elaborated term by coiteration.
public static func coiterate(elaborate: Term throws -> Expression<Term>)(_ seed: Term) rethrows -> Elabo... | // Copyright © 2015 Rob Rix. All rights reserved.
public enum Elaborated<Term: TermType>: TermContainerType {
indirect case Unroll(Term, Expression<Elaborated>)
/// Construct an elaborated term by coiteration.
public static func coiterate(elaborate: Term throws -> Expression<Term>)(_ seed: Term) rethrows -> Elabo... |
Add equality and hash value capability. | //
// Atom.swift
// IMVS
//
// Created by Allistair Crossley on 06/07/2014.
// Copyright (c) 2014 Allistair Crossley. All rights reserved.
//
import Foundation
class Atom {
var id: String = ""
var name: String = ""
var residue: String = ""
var chain: String = ""
var element: String =... | //
// Atom.swift
// IMVS
//
// Created by Allistair Crossley on 06/07/2014.
// Copyright (c) 2014 Allistair Crossley. All rights reserved.
//
import Foundation
class Atom : Hashable {
var id: String = ""
var name: String = ""
var residue: String = ""
var chain: String = ""
var element... |
Test >>- over right values. | // Copyright (c) 2014 Rob Rix. All rights reserved.
import Either
import Prelude
import XCTest
final class EitherTests: XCTestCase {
let left = Either<Int, String>.left(4)
let right = Either<Int, String>.right("four")
func isFull<T>(string: String) -> Either<T, Bool> {
return .right(!string.isEmpty)
}
// M... | // Copyright (c) 2014 Rob Rix. All rights reserved.
import Either
import Prelude
import XCTest
final class EitherTests: XCTestCase {
let left = Either<Int, String>.left(4)
let right = Either<Int, String>.right("four")
func isFull<T>(string: String) -> Either<T, Bool> {
return .right(!string.isEmpty)
}
// M... |
Disable selecting and editing of about attributed string views. | //
// SettingsAttributedStringView.swift
// NetNewsWire-iOS
//
// Created by Maurice Parker on 9/16/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import SwiftUI
struct SettingsAttributedStringView: UIViewRepresentable {
let string: NSAttributedString
func makeUIView(context: Context)... | //
// SettingsAttributedStringView.swift
// NetNewsWire-iOS
//
// Created by Maurice Parker on 9/16/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import SwiftUI
struct SettingsAttributedStringView: UIViewRepresentable {
let string: NSAttributedString
func makeUIView(context: Context)... |
Use GH flavoured MD extensions for web view | //
// MDWebViewController.swift
// Markdown
//
// Created by Boris Bügling on 01/12/15.
// Copyright © 2015 Contentful GmbH. All rights reserved.
//
import MMMarkdown
import WebKit
class MDWebViewController: UIViewController {
convenience init() {
self.init(nibName: nil, bundle: nil)
self.tab... | //
// MDWebViewController.swift
// Markdown
//
// Created by Boris Bügling on 01/12/15.
// Copyright © 2015 Contentful GmbH. All rights reserved.
//
import MMMarkdown
import WebKit
class MDWebViewController: UIViewController {
convenience init() {
self.init(nibName: nil, bundle: nil)
self.tab... |
Remove unnecessary activity response types | //
// ActivityResponse.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
/** The model that defines the actions that can be taken for a given Activity entry */
public class ActivityResponse: JSONEncodable {
public enum ActivityResponseType: String {
... | //
// ActivityResponse.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
/** The model that defines the actions that can be taken for a given Activity entry */
public class ActivityResponse: JSONEncodable {
public enum ActivityResponseType: String {
... |
Convert hit point to viewForClearTouches coordinate system | //
// ClearContainerView.swift
// SlideOutable
//
// Created by Domas Nutautas on 20/05/16.
// Copyright © 2016 Domas Nutautas. All rights reserved.
//
import UIKit
// MARK: - ContainterView
///
/// Passes touches if background is clear and point is not inside one of its subviews
///
open class ClearContainerVie... | //
// ClearContainerView.swift
// SlideOutable
//
// Created by Domas Nutautas on 20/05/16.
// Copyright © 2016 Domas Nutautas. All rights reserved.
//
import UIKit
// MARK: - ContainterView
///
/// Passes touches if background is clear and point is not inside one of its subviews
///
open class ClearContainerVie... |
Make error message more user friendly | //
// Created by Christopher Trott on 10/22/15.
// Copyright © 2015 twocentstudios. All rights reserved.
//
import Foundation
public enum EventError : ErrorType {
case UnderlyingError(error: NSError)
case InvalidResponse
case ImageURLMissing
case StreamURLMissing
case UnknownError
func ... | //
// Created by Christopher Trott on 10/22/15.
// Copyright © 2015 twocentstudios. All rights reserved.
//
import Foundation
public enum EventError : ErrorType {
case UnderlyingError(error: NSError)
case InvalidResponse
case ImageURLMissing
case StreamURLMissing
case UnknownError
func ... |
Refactor to loadImageNamed. 8 tests still passing. | //
// FuelGaugeView.swift
// FuelGaugeKit
//
// Created by Ron Lisle on 3/19/15.
// Copyright (c) 2015 Ron Lisle. All rights reserved.
//
import UIKit
class FuelGaugeView: UIView {
var backgroundImage:UIImageView!
var needleImage:UIImageView!
override func layoutSubviews() {
super.layoutSubv... | //
// FuelGaugeView.swift
// FuelGaugeKit
//
// Created by Ron Lisle on 3/19/15.
// Copyright (c) 2015 Ron Lisle. All rights reserved.
//
import UIKit
class FuelGaugeView: UIView {
var backgroundImage:UIImageView!
var needleImage:UIImageView!
override func layoutSubviews() {
super.layoutSubv... |
Remove unnecessary @testable import of Swinject. | //
// Container+SwinjectStoryboardSpec.swift
// Swinject
//
// Created by Yoichi Tagaya on 2/27/16.
// Copyright © 2016 Swinject Contributors. All rights reserved.
//
import Quick
import Nimble
@testable import Swinject
#if os(iOS) || os(OSX) || os(tvOS)
class Container_SwinjectStoryboardSpec: QuickSpec {
ove... | //
// Container+SwinjectStoryboardSpec.swift
// Swinject
//
// Created by Yoichi Tagaya on 2/27/16.
// Copyright © 2016 Swinject Contributors. All rights reserved.
//
import Quick
import Nimble
import Swinject
#if os(iOS) || os(OSX) || os(tvOS)
class Container_SwinjectStoryboardSpec: QuickSpec {
override func... |
Add missing newline to the end. | #!/usr/bin/env swiftshell
import SwiftShell
for line in open("../shorttext.txt").lines() {
// Do something with each line
println(line)
} | #!/usr/bin/env swiftshell
import SwiftShell
for line in open("../shorttext.txt").lines() {
// Do something with each line
println(line)
}
|
Fix to create view snapshot | //
// UIView+SnapshotImage.swift
// View2ViewTransitionExample
//
// Created by naru on 2016/08/29.
// Copyright © 2016年 naru. All rights reserved.
//
import UIKit
public extension UIView {
public func snapshotImage() -> UIImage? {
let size: CGSize = CGSize(width: floor(self.frame.size.w... | //
// UIView+SnapshotImage.swift
// View2ViewTransitionExample
//
// Created by naru on 2016/08/29.
// Copyright © 2016年 naru. All rights reserved.
//
import UIKit
public extension UIView {
public func snapshotImage() -> UIImage? {
let size: CGSize = CGSize(width: floor(self.frame.size.w... |
Update public database query property | import FirebaseCommunity
import HandyJSON
open class FireRecord: FirebaseModel {
public var key: String?
public static var fireRecordReference: DatabaseReference?
static var fireRecordQuery: DatabaseQuery?
required public init() {}
public func mapping(mapper: HelpingMapper) {
mapper >... | import FirebaseCommunity
import HandyJSON
open class FireRecord: FirebaseModel {
public var key: String?
public static var fireRecordReference: DatabaseReference?
public static var fireRecordQuery: DatabaseQuery?
required public init() {}
public func mapping(mapper: HelpingMapper) {
m... |
Use latest levels of SwiftyJSON and Kitura-Net | import PackageDescription
#if os(Linux)
let swiftyJsonUrl = "https://github.com/IBM-Swift/SwiftyJSON.git"
let swiftyJsonVersion = 3
#else
let swiftyJsonUrl = "https://github.com/SwiftyJSON/SwiftyJSON.git"
let swiftyJsonVersion = 2
#endif
let package = Package(
name: "zosconnectforswift",
targets: ... | import PackageDescription
#if os(Linux)
let swiftyJsonUrl = "https://github.com/IBM-Swift/SwiftyJSON.git"
let swiftyJsonVersion = 3
#else
let swiftyJsonUrl = "https://github.com/SwiftyJSON/SwiftyJSON.git"
let swiftyJsonVersion = 2
#endif
let package = Package(
name: "zosconnectforswift",
targets: ... |
Upgrade package manifest to Swift 4 | //
// Package.swift
// CoreTensor
//
// Copyright 2016-2017 Richard Wei.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unl... | // swift-tools-version:4.0
//
// Package.swift
// CoreTensor
//
// Copyright 2016-2017 Richard Wei.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/lice... |
Add test for jukebox observing | //
// EveryoneGetsToDJTests.swift
// EveryoneGetsToDJTests
//
// Created by Patrick O'Leary on 6/7/17.
// Copyright © 2017 Patrick O'Leary. All rights reserved.
//
import XCTest
@testable import EveryoneGetsToDJ
class EveryoneGetsToDJTests: XCTestCase {
override func setUp() {
super.setUp()
... | //
// EveryoneGetsToDJTests.swift
// EveryoneGetsToDJTests
//
// Created by Patrick O'Leary on 6/7/17.
// Copyright © 2017 Patrick O'Leary. All rights reserved.
//
import XCTest
@testable import EveryoneGetsToDJ
import PromiseKit
class EveryoneGetsToDJTests: XCTestCase {
override func setUp() {
s... |
Add test searching with empty string | import XCTest
@testable import worldcities
class TestModelListSearch:XCTestCase
{
private let kWaitExpectation:TimeInterval = 90
func testSearchItems()
{
let itemsExpectation:XCTestExpectation = expectation(
description:"items loaded")
let modelList:ModelList = Mod... | import XCTest
@testable import worldcities
class TestModelListSearch:XCTestCase
{
private let kStringEmpty:String = ""
private let kWaitExpectation:TimeInterval = 90
func testSearchItems()
{
let itemsExpectation:XCTestExpectation = expectation(
description:"items loaded")
... |
Make the content of a captured stream public | //
// OutputByteStream.swift
// SwiftCLI
//
// Created by Jake Heiser on 9/11/17.
//
import Foundation
public protocol OutputByteStream {
func output(_ content: String)
}
public class StdoutStream: OutputByteStream {
public init() {}
public func output(_ content: String) {
print(content)
}... | //
// OutputByteStream.swift
// SwiftCLI
//
// Created by Jake Heiser on 9/11/17.
//
import Foundation
public protocol OutputByteStream {
func output(_ content: String)
}
public class StdoutStream: OutputByteStream {
public init() {}
public func output(_ content: String) {
print(content)
}... |
Update participant role mapping with new role identifiers | //
// Appearance.swift
// JumuNordost
//
// Created by Martin Richter on 21/02/16.
// Copyright © 2016 Martin Richter. All rights reserved.
//
import Argo
import Curry
enum ParticipantRole: String {
case Soloist = "S"
case Ensemblist = "E"
case Accompanist = "B"
}
struct Appearance {
let particip... | //
// Appearance.swift
// JumuNordost
//
// Created by Martin Richter on 21/02/16.
// Copyright © 2016 Martin Richter. All rights reserved.
//
import Argo
import Curry
enum ParticipantRole: String {
case Soloist = "soloist"
case Ensemblist = "ensemblist"
case Accompanist = "accompanist"
}
struct Appe... |
Remove option from test that did not do anything. | // RUN: %target-build-swift -target arm64-apple-ios8.0 -target-cpu cyclone \
// RUN: -O -S %s -parse-as-library | \
// RUN: FileCheck --check-prefix=TBI %s
// RUN: %target-build-swift -target arm64-apple-ios8.0 -target-cpu cyclone \
// RUN: -Xcc -Xclang -Xcc -target-feature -Xcc -Xclang ... | // RUN: %target-build-swift -target arm64-apple-ios8.0 -target-cpu cyclone \
// RUN: -O -S %s -parse-as-library | \
// RUN: FileCheck --check-prefix=TBI %s
// RUN: %target-build-swift -target arm64-apple-ios8.0 -target-cpu cyclone \
// RUN: -O -S %s -parse-as-library | \
// RUN: FileCh... |
Fix the dependency versions to use semantic version numbers | // swift-tools-version:5.0
import PackageDescription
let package = Package(
name: "Bond",
platforms: [
.macOS(.v10_11), .iOS(.v8), .tvOS(.v9)
],
products: [
.library(name: "Bond", targets: ["Bond"])
],
dependencies: [
.package(url: "https://github.com/DeclarativeHub/Reac... | // swift-tools-version:5.0
import PackageDescription
let package = Package(
name: "Bond",
platforms: [
.macOS(.v10_11), .iOS(.v8), .tvOS(.v9)
],
products: [
.library(name: "Bond", targets: ["Bond"])
],
dependencies: [
.package(url: "https://github.com/DeclarativeHub/Reac... |
Remove constraints to generic arguments | //
// RACHelpers.swift
// TodaysReactiveMenu
//
// Created by Steffen Damtoft Sommer on 25/05/15.
// Copyright (c) 2015 steffendsommer. All rights reserved.
//
import Foundation
import ReactiveCocoa
public func ignoreNil<T: AnyObject, E: Any>(signalProducer: SignalProducer<T?, E>) -> SignalProducer<T?, E> {
ret... | //
// RACHelpers.swift
// TodaysReactiveMenu
//
// Created by Steffen Damtoft Sommer on 25/05/15.
// Copyright (c) 2015 steffendsommer. All rights reserved.
//
import ReactiveCocoa
public func ignoreNil<T: AnyObject, E: Any>(signalProducer: SignalProducer<T?, E>) -> SignalProducer<T?, E> {
return signalProducer... |
Add the AEXML dependency to the package. | import PackageDescription
let package = Package(
name: "GPXKit"
)
| import PackageDescription
let package = Package(
name: "GPXKit",
dependencies: [
.Package(url: "https://github.com/fousa/AEXML.git", majorVersion: 2, minor: 1)
]
)
|
Make sure test case does not collide with private discriminators. | // RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
protocol DrawingElementDispatchType {}
extension DrawingElementDispatchType {
final var boundingBox: Int32 {
return 0
}
}
protocol DrawingElementType : DrawingElementDispatchType {
var boundingBox: Int32 {get}
}
struct D : DrawingElementType {
... | // RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
protocol DrawingElementDispatchType {}
extension DrawingElementDispatchType {
final var boundingBox: Int32 {
return 0
}
}
protocol DrawingElementType : DrawingElementDispatchType {
var boundingBox: Int32 {get}
}
struct D : DrawingElementType {
... |
Make about field in error object optional since it is not always present. | //
// AppleMusicAPIError.swift
// Cider
//
// Created by Scott Hoyt on 8/9/17.
// Copyright © 2017 Scott Hoyt. All rights reserved.
//
import Foundation
struct AppleMusicAPIError: Error, Codable {
let id: String
let about: String
let status: String
let code: String
let title: String
let de... | //
// AppleMusicAPIError.swift
// Cider
//
// Created by Scott Hoyt on 8/9/17.
// Copyright © 2017 Scott Hoyt. All rights reserved.
//
import Foundation
struct AppleMusicAPIError: Error, Codable {
let id: String
let about: String?
let status: String
let code: String
let title: String
let d... |
Remove the "AshtonDynamic" library product | // swift-tools-version:5.1
import PackageDescription
let package = Package(
name: "Ashton",
platforms: [.iOS("13.4"), .macOS(.v10_15)],
products: [
.library(name: "Ashton", targets: ["Ashton"]),
.library(name: "AshtonDynamic", type: .dynamic, targets: ["Ashton"]),
],
targets: [
... | // swift-tools-version:5.1
import PackageDescription
let package = Package(
name: "Ashton",
platforms: [.iOS("13.4"), .macOS(.v10_15)],
products: [.library(name: "Ashton", targets: ["Ashton"])],
targets: [
.target(
name: "Ashton",
dependencies: [],
path: "Sou... |
Upgrade to Swift 3 syntax | //
// main.swift
// swcat
//
// Created by Caius Durling on 03/06/2014.
// Copyright (c) 2014 Caius Durling. All rights reserved.
//
// cat(1) (not a full) clone written in swift
//
// Given no arguments, prints stdin to stdout. Given arguments reads them as files, printing content to stdout. Errors on stderr if f... | //
// main.swift
// swcat
//
// Created by Caius Durling on 03/06/2014.
// Copyright (c) 2014 Caius Durling. All rights reserved.
//
// cat(1) (not a full) clone written in swift
//
// Given no arguments, prints stdin to stdout. Given arguments reads them as files, printing content to stdout. Errors on stderr if f... |
Test cases should pass now | //
// ZapicTests.swift
// ZapicTests
//
// Created by Daniel Sarfati on 6/30/17.
// Copyright © 2017 Zapic. All rights reserved.
//
import XCTest
@testable import Zapic
class ZapicTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called befor... | //
// ZapicTests.swift
// ZapicTests
//
// Created by Daniel Sarfati on 6/30/17.
// Copyright © 2017 Zapic. All rights reserved.
//
import XCTest
@testable import Zapic
class ZapicTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called befor... |
Use Task.runDetached instead of custom runAsync | //
// AsyncExtensions.swift
// Promissum
//
// Created by Tom Lokhorst on 2021-03-06.
//
import Foundation
import _Concurrency
extension Promise {
public func get() async throws -> Value {
try await withUnsafeThrowingContinuation { continuation in
self.finallyResult { result in
continuation.res... | //
// AsyncExtensions.swift
// Promissum
//
// Created by Tom Lokhorst on 2021-03-06.
//
import Foundation
import _Concurrency
extension Promise {
public func get() async throws -> Value {
try await withUnsafeThrowingContinuation { continuation in
self.finallyResult { result in
continuation.res... |
Add new common enum type named 'EmptyEnum' | //
// Enumable.swift
// SwiftyEcharts
//
// Created by Pluto Y on 15/01/2017.
// Copyright © 2017 com.pluto-y. All rights reserved.
//
public protocol Enumable {
associatedtype ContentEnum
init(_ elements: Self.ContentEnum...)
}
extension Enumable {
public init(_ element: Self.ContentEnum) {
/... | //
// Enumable.swift
// SwiftyEcharts
//
// Created by Pluto Y on 15/01/2017.
// Copyright © 2017 com.pluto-y. All rights reserved.
//
/// 针对那种只有只读属性或者没有属性的类型
public enum EmptyEnum { }
public protocol Enumable {
associatedtype ContentEnum
init(_ elements: Self.ContentEnum...)
}
extension Enumable {
p... |
Fix reference for the Schedule table | import Foundation
import SwiftUI
import MapKit
import Combine
public class FeedViewModel: ObservableObject {
@ObservedObject var store = NSBrazilStore()
private var cancellable: AnyCancellable? = nil
public init() {
fetchInfo()
}
func fetchInfo() {
isLoading = true
cancel... | import Foundation
import SwiftUI
import MapKit
import Combine
public class FeedViewModel: ObservableObject {
@ObservedObject var store = NSBrazilStore()
private var cancellable: AnyCancellable? = nil
public init() {
fetchInfo()
}
func fetchInfo() {
isLoading = true
cancel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.