Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Remove unnecessary code of Xcode automatic conversion
// // NSRunLoop+Utils.swift // // This source file is part of the Telegram Bot SDK for Swift (unofficial). // // Copyright (c) 2015 - 2016 Andrey Fidrya and the project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See LICENSE.txt for license information // See AUTHORS.txt for the l...
// // NSRunLoop+Utils.swift // // This source file is part of the Telegram Bot SDK for Swift (unofficial). // // Copyright (c) 2015 - 2016 Andrey Fidrya and the project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See LICENSE.txt for license information // See AUTHORS.txt for the l...
Use consistent variable name in documentation
// // Copyright (c) 2017 Google Inc. // // 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 // // Unless required by applicable law or agre...
// // Copyright (c) 2017 Google Inc. // // 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 // // Unless required by applicable law or agre...
Enable logs in test project
// // AppDelegate.swift // React // // Created by Sacha Durand Saint Omer on 29/03/2017. // Copyright © 2017 Freshos. All rights reserved. // // TODO stateless component ? // TODO ViewLayout with spacies and margins in the childrne's aray ?? import UIKit import Komponents @UIApplicationMain class AppDelegate: UI...
// // AppDelegate.swift // React // // Created by Sacha Durand Saint Omer on 29/03/2017. // Copyright © 2017 Freshos. All rights reserved. // // TODO stateless component ? // TODO ViewLayout with spacies and margins in the childrne's aray ?? import UIKit import Komponents @UIApplicationMain class AppDelegate: UI...
Add typealiases for BlockOperation and OperationQueueDelegate
// // Swift3Typealiases.swift // PSOperations // // Created by Dev Team on 9/20/16. // Copyright © 2016 Pluralsight. All rights reserved. // public typealias PSOperation = Operation public typealias PSOperationQueue = OperationQueue
// // Swift3Typealiases.swift // PSOperations // // Created by Dev Team on 9/20/16. // Copyright © 2016 Pluralsight. All rights reserved. // public typealias PSOperation = Operation public typealias PSOperationQueue = OperationQueue public typealias PSOperationQueueDelegate = OperationQueueDelegate public typealia...
Add an override for -->
// Copyright (c) 2015 Rob Rix. All rights reserved. /// Returns a parser which maps parse trees into another type. public func --> <C: CollectionType, T, U>(parser: Parser<C, T>.Function, f: (C, Range<C.Index>, T) -> U) -> Parser<C, U>.Function { return { input, sourcePos in parser(input, sourcePos).map { (f(input...
// Copyright (c) 2015 Rob Rix. All rights reserved. /// Returns a parser which maps parse trees into another type. public func --> <C: CollectionType, T, U>(parser: Parser<C, T>.Function, f: (C, SourcePos<C.Index>, Range<C.Index>, T) -> U) -> Parser<C, U>.Function { return { input, inputPos in parser(input, inputP...
Add sign/verify and key exchange tests
import XCTest @testable import Ed25519 class Ed25519Tests: XCTestCase { func testSeed() throws { let seed = try Seed() XCTAssertNotEqual([UInt8](repeating: 0, count: 32), seed.buffer) } static var allTests = [ ("testSeed", testSeed), ] }
import XCTest @testable import Ed25519 class Ed25519Tests: XCTestCase { func testSeed() throws { let seed = try Seed() XCTAssertEqual(32, seed.bytes.count) XCTAssertNotEqual([UInt8](repeating: 0, count: 32), seed.bytes) } func testSignAndVerify() throws { let seed ...
Fix test failure on iPad
import XCTest class ScreenshotGenerator: XCTestCase { var app: XCUIApplication! let automationController = AutomationController() override func setUp() { super.setUp() app = automationController.app setupSnapshot(app) enforceCorrectDeviceOrientation() ...
import XCTest class ScreenshotGenerator: XCTestCase { var app: XCUIApplication! let automationController = AutomationController() override func setUp() { super.setUp() app = automationController.app setupSnapshot(app) enforceCorrectDeviceOrientation() ...
Improve UIViewController add/remove child methods
// // Premier+UIViewController.swift // PremierKit // // Created by Ricardo Pereira on 24/08/2019. // Copyright © 2019 Ricardo Pereira. All rights reserved. // import UIKit extension UIViewController { func add(_ child: UIViewController) { addChild(child) view.addSubview(child.view) c...
// // Premier+UIViewController.swift // PremierKit // // Created by Ricardo Pereira on 24/08/2019. // Copyright © 2019 Ricardo Pereira. All rights reserved. // import UIKit extension UIViewController { public func add(asChildViewController viewController: UIViewController) { addChild(viewController) ...
Add internal struct Logger that will be used as a default logger
// // AsyncType+Debug.swift // BrightFutures // // Created by Oleksii on 23/09/2016. // Copyright © 2016 Thomas Visser. All rights reserved. // import Result public protocol LoggerType { func log(message: String) }
// // AsyncType+Debug.swift // BrightFutures // // Created by Oleksii on 23/09/2016. // Copyright © 2016 Thomas Visser. All rights reserved. // import Result public protocol LoggerType { func log(message: String) } struct Logger: LoggerType { func log(message: String) { print(message) } }
Use predicate instead of mather for tests
// // Satisfy.swift // OMM // // Created by Ivan Nikitin on 06/10/16. // Copyright © 2016 Ivan Nikitin. All rights reserved. // import Nimble func satisfy<T>(closure: @escaping (T) -> Void) -> MatcherFunc<T> { return MatcherFunc { actualExpression, failureMessage in failureMessage.postfixMessage = "sa...
// // Satisfy.swift // OMM // // Created by Ivan Nikitin on 06/10/16. // Copyright © 2016 Ivan Nikitin. All rights reserved. // import Nimble func satisfy<T>(closure: @escaping (T) -> Void) -> Predicate<T> { return Predicate.simple("satisfy closure") { actualExpression in guard let actualValue = try a...
Fix problem with file path with spaces
// // IgnoreFile.swift // R.swift // // Created by Mathijs Kadijk on 01-10-16. // Copyright © 2016 Mathijs Kadijk. All rights reserved. // import Foundation class IgnoreFile { private let patterns: [NSURL] init() { patterns = [] } init(ignoreFileURL: URL) throws { let parentDirString = ignoreFil...
// // IgnoreFile.swift // R.swift // // Created by Mathijs Kadijk on 01-10-16. // Copyright © 2016 Mathijs Kadijk. All rights reserved. // import Foundation class IgnoreFile { private let patterns: [NSURL] init() { patterns = [] } init(ignoreFileURL: URL) throws { let parentDirString = ignoreFil...
Improve tests for private methods testing
// https://github.com/Quick/Quick import Quick import Nimble import LoginKit class LoginKitSpec: QuickSpec { override func spec() { describe("testing travis ci"){ it("failure") { expect(2) == 1 } it("success") { expect(1) == 1 ...
// https://github.com/Quick/Quick import Quick import Nimble @testable import LoginKit class LoginKitSpec: QuickSpec { override func spec() { describe("testing travis ci"){ it("failure") { expect(2) == 1 } it("success") { expect...
Add tests for TabmanBar itemCountLimit
// // TabmanViewControllerTests.swift // Tabman // // Created by Merrick Sapsford on 08/03/2017. // Copyright © 2017 Merrick Sapsford. All rights reserved. // import XCTest @testable import Tabman import Pageboy class TabmanViewControllerTests: XCTestCase { var tabmanViewController: TabmanTestViewController!...
// // TabmanViewControllerTests.swift // Tabman // // Created by Merrick Sapsford on 08/03/2017. // Copyright © 2017 Merrick Sapsford. All rights reserved. // import XCTest @testable import Tabman import Pageboy class TabmanViewControllerTests: XCTestCase { var tabmanViewController: TabmanTestViewController!...
Fix deprecation warning about event.context being deprecated and always nil on 10.12 and later
/* Copyright (c) 2001-2020, Kurt Revis. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. */ import Cocoa class SourcesOutlineView: NSOutlineView { override func mouseDown(with event: NSEvent) { // Igno...
/* Copyright (c) 2001-2020, Kurt Revis. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. */ import Cocoa class SourcesOutlineView: NSOutlineView { override func mouseDown(with event: NSEvent) { // Igno...
Use AppDelegateAssemblyStub when running tests
import UIKit extension Container { var appDelegateAssembly: AppDelegateAssembly { return Assembly() } private struct Assembly: AppDelegateAssembly { var window: UIWindow { let window = UIWindow(frame: UIScreen.main.bounds) window.rootViewController = ViewControlle...
import UIKit extension Container { var appDelegateAssembly: AppDelegateAssembly { if let stubClass = NSClassFromString("SharedShoppingAppTests.AppDelegateAssemblyStub") as? NSObject.Type, let stubInstance = stubClass.init() as? AppDelegateAssembly { return stubInstance } ...
Fix ToDoAction did not conform to Action
import TDRedux public typealias Store = TDRedux.Store<State> public protocol ToDoAction { } public struct ToDo { public let title: String public init(title: String) { self.title = title } } public struct State { public static let initial = State.init(todos: []) public let todos: [ToDo]...
import TDRedux public typealias Store = TDRedux.Store<State> public protocol ToDoAction: Action { } public struct ToDo { public let title: String public init(title: String) { self.title = title } } public struct State { public static let initial = State.init(todos: []) public let todos...
Replace `join` on a string with `joinWithSeparator` on a collection of strings.
// // OpenWeatherMap.swift // SwinjectSimpleExample // // Created by Yoichi Tagaya on 8/10/15. // Copyright © 2015 Swinject Contributors. All rights reserved. // struct OpenWeatherMap { // Replace the empty string with YOUR OWN KEY! // The key is available for free. // http://openweathermap.org pri...
// // OpenWeatherMap.swift // SwinjectSimpleExample // // Created by Yoichi Tagaya on 8/10/15. // Copyright © 2015 Swinject Contributors. All rights reserved. // struct OpenWeatherMap { // Replace the empty string with YOUR OWN KEY! // The key is available for free. // http://openweathermap.org pri...
Return resource bundle only when it exists
// // DDKHelper.swift // DJIDemoKitDemo // // Created by Pandara on 2017/8/31. // Copyright © 2017年 Pandara. All rights reserved. // import UIKit public class DDKHelper { public class func showAlert(title: String?, message: String?, at viewCon: UIViewController) { let alert = UIAlertController(title: ...
// // DDKHelper.swift // DJIDemoKitDemo // // Created by Pandara on 2017/8/31. // Copyright © 2017年 Pandara. All rights reserved. // import UIKit public class DDKHelper { public class func showAlert(title: String?, message: String?, at viewCon: UIViewController) { let alert = UIAlertController(title: ...
Replace magic number `1` with `STDOUT_FILENO`.
// // Formatting.swift // Carthage // // Created by J.D. Healy on 1/29/15. // Copyright (c) 2015 Carthage. All rights reserved. // import Commandant import Foundation import LlamaKit import PrettyColors import ReactiveCocoa extension Color.Wrap { func autowrap(string: String) -> String { return Formatting.colo...
// // Formatting.swift // Carthage // // Created by J.D. Healy on 1/29/15. // Copyright (c) 2015 Carthage. All rights reserved. // import Commandant import Foundation import LlamaKit import PrettyColors import ReactiveCocoa extension Color.Wrap { func autowrap(string: String) -> String { return Formatting.colo...
Add constant for manga eden image url prefix
// // ImageURL.swift // Yomu // // Created by Sendy Halim on 6/10/16. // Copyright © 2016 Sendy Halim. All rights reserved. // import Foundation import Argo /// A data structure that represents image url that points to Mangaeden api /// docs: http://www.mangaeden.com/api/ struct ImageURL: CustomStringConvertibl...
// // ImageURL.swift // Yomu // // Created by Sendy Halim on 6/10/16. // Copyright © 2016 Sendy Halim. All rights reserved. // import Foundation import Argo /// A data structure that represents image url that points to Mangaeden api /// docs: http://www.mangaeden.com/api/ struct ImageURL: CustomStringConvertibl...
Clean up file manager block in Swift 2
// // NSFileManager+DirectoryContents.swift // URLGrey // // Created by Zachary Waldowski on 10/23/14. // Copyright © 2014-2015. Some rights reserved. // import Foundation // MARK: Directory Enumeration extension NSFileManager { public func directory(URL url: NSURL, fetchResources: [URLResourceType] = [...
// // NSFileManager+DirectoryContents.swift // URLGrey // // Created by Zachary Waldowski on 10/23/14. // Copyright © 2014-2015. Some rights reserved. // import Foundation // MARK: Directory Enumeration extension NSFileManager { public func directory(URL url: NSURL, fetchResources: [URLResourceType] = [...
Add split enabled to init track
// // MercadoPagoCheckout+Tracking.swift // MercadoPagoSDK // // Created by Eden Torres on 13/12/2018. // import Foundation // MARK: Tracking extension MercadoPagoCheckout { internal func startTracking() { MPXTracker.sharedInstance.setPublicKey(viewModel.publicKey) MPXTracker.sharedInstance.st...
// // MercadoPagoCheckout+Tracking.swift // MercadoPagoSDK // // Created by Eden Torres on 13/12/2018. // import Foundation // MARK: Tracking extension MercadoPagoCheckout { internal func startTracking() { MPXTracker.sharedInstance.setPublicKey(viewModel.publicKey) MPXTracker.sharedInstance.st...
Fix brace (from Hound CI's comment).
// // RoutingProtocol.swift // SUSwiftSugar // // Created by Suguru Kishimoto on 2016/03/23. // // import Foundation public protocol RoutingProtocol { associatedtype ParameterType = AnyObject func presentViewController<To: RoutingProtocol where To: UIViewController> (viewController: To, parame...
// // RoutingProtocol.swift // SUSwiftSugar // // Created by Suguru Kishimoto on 2016/03/23. // // import Foundation public protocol RoutingProtocol { associatedtype ParameterType = AnyObject func presentViewController<To: RoutingProtocol where To: UIViewController> (viewController: To, parame...
Optimize solution to Binary Tree Zigzag Level Order Traversal
/** * Question Link: https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ * Primary idea: use a queue to help hold TreeNode, and for each level add a new Int array * * Note: use a boolean value to determine if needs to be added reversely * * Time Complexity: O(n), Space Complexity: O(n) * * D...
/** * Question Link: https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ * Primary idea: use a queue to help hold TreeNode, and for each level add a new Int array * * Note: use a boolean value to determine if needs to be added reversely * * Time Complexity: O(n), Space Complexity: O(n) * * D...
Add corner radius to sb app icons.
// // SpringBoardAppIconViewCell.swift // UIPlayground // // Created by Kip Nicol on 9/20/16. // Copyright © 2016 Kip Nicol. All rights reserved. // import UIKit class SpringBoardAppIconViewCell: UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) setup...
// // SpringBoardAppIconViewCell.swift // UIPlayground // // Created by Kip Nicol on 9/20/16. // Copyright © 2016 Kip Nicol. All rights reserved. // import UIKit class SpringBoardAppIconViewCell: UICollectionViewCell { let cornerRadius = CGFloat(12) override init(frame: CGRect) { super.i...
Support Xcode 7 beta 6
// // Helper functions to work with strings. // import Foundation public struct TegString { public static func blank(text: String) -> Bool { let trimmed = text.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) return trimmed.isEmpty } public static func trim(text: String) -> Str...
// // Helper functions to work with strings. // import Foundation public struct TegString { public static func blank(text: String) -> Bool { let trimmed = text.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) return trimmed.isEmpty } public static func trim(text: Stri...
Add a test for init with name
// // BeerTests.swift // BreweryDB // // Created by Jake Welton on 1/3/16. // Copyright © 2016 Jake Welton. All rights reserved. // import XCTest class BeerTests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each...
// // BeerTests.swift // BreweryDB // // Created by Jake Welton on 1/3/16. // Copyright © 2016 Jake Welton. All rights reserved. // import XCTest @testable import BreweryDB class BeerTests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called be...
Edit : w poprzednim commicie zapomnialem skompilowac projektu wiec wrzucam kolejny commit juz po kompilacji
// // TestLogic.swift // StudyBox_iOS // // Created by user on 12.03.2016. // Copyright © 2016 BLStream. All rights reserved. // import Foundation class Test { private var deck : [Flashcard] private var currentCard : Flashcard? private var passedFlashcards = 0 private var index = 0 privat...
// // TestLogic.swift // StudyBox_iOS // // Created by user on 12.03.2016. // Copyright © 2016 BLStream. All rights reserved. // import Foundation class Test { private var deck : [Flashcard] private var currentCard : Flashcard? private var passedFlashcards = 0 private var index = 0 privat...
Change method to overload to the one that supported Any
/// Set value for key of an instance public func set(_ value: Any, key: String, for instance: inout Any) throws { try property(type: type(of: instance), key: key).write(value, to: mutableStorage(instance: &instance)) } /// Set value for key of an instance public func set(_ value: Any, key: String, for instance: An...
/// Set value for key of an instance public func set(_ value: Any, key: String, for instance: inout Any, instanceType: Any.Type? = nil) throws { let type = instanceType ?? type(of: instance) try property(type: type(of: instance), key: key).write(value, to: mutableStorage(instance: &instance, type: type)) } ///...
Add a fold overload that will work on Array.
// Copyright © 2015 Rob Rix. All rights reserved. extension CollectionType { public var uncons: (first: SubSequence._Element, rest: SubSequence)? { if !isEmpty { let some = self[startIndex..<startIndex.advancedBy(1)] return (first: some[some.startIndex], rest: dropFirst()) } return nil } public var re...
// Copyright © 2015 Rob Rix. All rights reserved. extension CollectionType { public var uncons: (first: SubSequence._Element, rest: SubSequence)? { if !isEmpty { let some = self[startIndex..<startIndex.advancedBy(1)] return (first: some[some.startIndex], rest: dropFirst()) } return nil } public var re...
Make N, S accessible from the command line
/* RECUR 1 SWIFT Simply run with: 'swift-t recur-1.swift | nl' */ app (void v) dummy(string parent, int stage, int id, void block) { "echo" ("parent='%3s'"%parent) ("stage="+stage) ("id="+id) ; } N = 4; // Data split factor S = 3; // Maximum stage number (tested up to S=7, 21,844 dummy tasks) (void v) runsta...
/* RECUR 1 SWIFT Simply run with: 'swift-t recur-1.swift | nl' Or specify the N, S values: 'swift-t recur-1.swift -N=6 -S=6 | nl' for 55,986 tasks. */ import sys; app (void v) dummy(string parent, int stage, int id, void block) { "echo" ("parent='%3s'"%parent) ("stage="+stage) ("id="+id) ; } // Data sp...
Throw error correctly (for real this time)
import Vapor import Validation public struct JSONValidator: Validator { public func validate(_ input: String) throws { do { _ = try JSON(bytes: input.makeBytes()) } catch { throw Validator.error("Invalid JSON.") } } }
import Vapor import Validation public struct JSONValidator: Validator { public func validate(_ input: String) throws { do { _ = try JSON(bytes: input.makeBytes()) } catch { throw self.error("Invalid JSON.") } } }
Add cocoapods conditional import of Moya in ReactiveMoyaAvialability.
import Moya import ReactiveSwift @available(*, unavailable, renamed: "ReactiveSwiftMoyaProvider") public class ReactiveCocoaMoyaProvider { } extension ReactiveSwiftMoyaProvider { @available(*, unavailable, renamed: "request(_:)") public func request(token: Target) -> SignalProducer<Response, MoyaError> { fata...
#if !COCOAPODS import Moya #endif import ReactiveSwift @available(*, unavailable, renamed: "ReactiveSwiftMoyaProvider") public class ReactiveCocoaMoyaProvider { } extension ReactiveSwiftMoyaProvider { @available(*, unavailable, renamed: "request(_:)") public func request(token: Target) -> SignalProducer<R...
Clarify text for initiating the initial download
// // PresentationTier.swift // Eurofurence // // Created by Thomas Sherwood on 09/07/2017. // Copyright © 2017 Eurofurence. All rights reserved. // import Foundation import UIKit struct PresentationTier { static func assemble(window: UIWindow) -> PresentationTier { return PresentationTier(window: wi...
// // PresentationTier.swift // Eurofurence // // Created by Thomas Sherwood on 09/07/2017. // Copyright © 2017 Eurofurence. All rights reserved. // import Foundation import UIKit struct PresentationTier { static func assemble(window: UIWindow) -> PresentationTier { return PresentationTier(window: wi...
Use Comparable to sort the free variables.
// Copyright (c) 2015 Rob Rix. All rights reserved. public func constraints(graph: Graph<Node>) -> (Term, constraints: ConstraintSet) { let parameters = Node.parameters(graph) let returns = Node.returns(graph) let returnType: Term = reduce(returns, nil) { $0.0.map { .product(Term(), $0) } ?? Term() } ?? .Unit ret...
// Copyright (c) 2015 Rob Rix. All rights reserved. public func constraints(graph: Graph<Node>) -> (Term, constraints: ConstraintSet) { let parameters = Node.parameters(graph) let returns = Node.returns(graph) let returnType: Term = reduce(returns, nil) { $0.0.map { .product(Term(), $0) } ?? Term() } ?? .Unit ret...
Add pre-defined errors from JSON-RPC spec
// ---------------------------------------------------------------------------- // // RPCError.swift // // @author Denis Kolyasev <kolyasev@gmail.com> // // ---------------------------------------------------------------------------- public class RPCError { // MARK: Construction init(code: Int, message: String,...
// ---------------------------------------------------------------------------- // // RPCError.swift // // @author Denis Kolyasev <kolyasev@gmail.com> // // ---------------------------------------------------------------------------- public struct RPCError: Error { // MARK: - Construction init(code: Int, messag...
Make Confiuration model properties public
import Foundation public struct Configuration { let token: String let units: Unit? let exclude: Exclude? let extend: Extend? let lang: String? init (token: String, units: Unit? = nil, exclude: Exclude? = nil, extend: Extend? = nil, lang: String? = ni...
import Foundation public struct Configuration { public let token: String public let units: Unit? public let exclude: Exclude? public let extend: Extend? public let lang: String? public init (token: String, units: Unit? = nil, exclude: Exclude? = nil, ...
Add computed property for perk type
import Foundation extension DPerk { }
import Foundation extension DPerk { var type:DPerkType { get { guard let type:DPerkType = DPerkType( rawValue:rawType) else { return DPerkType.error } ...
Add mission module ( Foundation )
/* * The MIT License (MIT) * * Copyright (C) 2019, CosmicMind, Inc. <http://cosmicmind.com>. * All rights reserved. * * 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 restricti...
/* * The MIT License (MIT) * * Copyright (C) 2019, CosmicMind, Inc. <http://cosmicmind.com>. * All rights reserved. * * 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 restricti...
Add long delay when starting session
import XCTest @testable import Phakchi class ControlServiceClientTestCase: XCTestCase { var controlServiceClient: ControlServiceClient! override func setUp() { super.setUp() self.controlServiceClient = ControlServiceClient() } func testStart() { var session: Session! l...
import XCTest @testable import Phakchi class ControlServiceClientTestCase: XCTestCase { var controlServiceClient: ControlServiceClient! override func setUp() { super.setUp() self.controlServiceClient = ControlServiceClient() } func testStart() { var session: Session! l...
Fix ReactiveTask errors being output too verbosely
// // main.swift // Carthage // // Created by Justin Spahr-Summers on 2014-10-10. // Copyright (c) 2014 Carthage. All rights reserved. // import CarthageKit import Commandant import Foundation import LlamaKit let commands = CommandRegistry() commands.register(BootstrapCommand()) commands.register(BuildCommand()) ...
// // main.swift // Carthage // // Created by Justin Spahr-Summers on 2014-10-10. // Copyright (c) 2014 Carthage. All rights reserved. // import CarthageKit import Commandant import Foundation import LlamaKit import ReactiveTask let commands = CommandRegistry() commands.register(BootstrapCommand()) commands.regis...
Add Swift package test target
// swift-tools-version:4.2 import PackageDescription let package = Package( name: "Metron", products: [.library(name: "Metron", targets: ["Metron"])], targets: [.target(name: "Metron", dependencies: [], path: "./source/Metron", exclude: ["Test"])] )
// swift-tools-version:4.2 // https://github.com/apple/swift-evolution/blob/master/proposals/0162-package-manager-custom-target-layouts.md // https://swift.org/package-manager import PackageDescription let package = Package( name: "Metron", products: [ .library(name: "Metron", targets: ["Metron"]) ...
Fix the path to make-old.py
// Ensure that the LLVMIR hash of the 2nd compilation in batch mode // is consistent no matter if the first one generates code or not. // RUN: %empty-directory(%t) // RUN: echo 'public enum E: Error {}' >%t/main.swift // RUN: echo >%t/other.swift // RUN: touch -t 201901010101 %t/*.swift // RUN: cd %t; %target-swift-f...
// Ensure that the LLVMIR hash of the 2nd compilation in batch mode // is consistent no matter if the first one generates code or not. // RUN: %empty-directory(%t) // RUN: echo 'public enum E: Error {}' >%t/main.swift // RUN: echo >%t/other.swift // RUN: touch -t 201901010101 %t/*.swift // RUN: cd %t; %target-swift-f...
Add conversion with functional operators for deserialization
// // FirebaseModel+Extension.swift // FirebaseCommunity // // Created by Victor Alisson on 15/08/17. // import Foundation import FirebaseCommunity public extension FirebaseModel { typealias JSON = [String: Any] internal static var classPath: DatabaseReference { return reference.child(Self.cla...
// // FirebaseModel+Extension.swift // FirebaseCommunity // // Created by Victor Alisson on 15/08/17. // import Foundation import FirebaseCommunity public extension FirebaseModel { typealias JSON = [String: Any] internal static var classPath: DatabaseReference { return reference.child(Self.cla...
Add a test for circular protocol inheritance through a typealias
// RUN: %target-typecheck-verify-swift // With a bit of effort, we could make this work -- but for now, let's just // not crash. protocol P { var x: Int { get set } // expected-note {{protocol requires property 'x' with type 'Int'; do you want to add a stub?}} } struct S : P { // expected-error {{type 'S' does not...
// RUN: %target-typecheck-verify-swift // With a bit of effort, we could make this work -- but for now, let's just // not crash. protocol P { var x: Int { get set } // expected-note {{protocol requires property 'x' with type 'Int'; do you want to add a stub?}} } struct S : P { // expected-error {{type 'S' does not...
Allow perf test-case for rdar://74035425 to run only on macOS
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan struct Value { let debugDescription: String } func test(values: [[Value]]) -> String { "[" + "" + values.map({ "[" + $0.map({ $0.debugDescription }).joined(separator: ", ") + "]" }).joined(separator: ", "...
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan // REQUIRES: OS=macosx struct Value { let debugDescription: String } func test(values: [[Value]]) -> String { "[" + "" + values.map({ "[" + $0.map({ $0.debugDescription }).joined(separator: ", ") + "]" })...
Update application didiFinishLaunching method with Swift 3 syntax
//////////////////////////////////////////////////////////////////////////////// // // TYPHOON FRAMEWORK // Copyright 2013, Jasper Blues & Contributors // All Rights Reserved. // // NOTICE: The authors permit you to use, modify, and distribute this file // in accordance with the terms of the license agreement acco...
//////////////////////////////////////////////////////////////////////////////// // // TYPHOON FRAMEWORK // Copyright 2013, Jasper Blues & Contributors // All Rights Reserved. // // NOTICE: The authors permit you to use, modify, and distribute this file // in accordance with the terms of the license agreement acco...
Make popPush public and generic.
// // PopPushAlgorithm.swift // TinyRedux // // Created by Daniel Tartaglia on 3/18/17. // Copyright © 2017 Daniel Tartaglia. All rights reserved. // import Foundation func popPush(current: [String], target: [String], pop: (String) -> Void, push: (String) -> Void) { var count = current.count if let indexOfCh...
// // PopPushAlgorithm.swift // TinyRedux // // Created by Daniel Tartaglia on 3/18/17. // Copyright © 2017 Daniel Tartaglia. All rights reserved. // import Foundation public func popPush<T>(current: [T], target: [T], pop: (T) -> Void, push: (T) -> Void) where T: Equatable { var count = current.count if let ...
Add check for post data
import Vapor import HTTP import Foundation final class PostController: ResourceRepresentable { func index(request: Request) throws -> ResponseRepresentable { // get all the post objects from the database return try Post.all().makeNode().converted(to: JSON.self) } func create(request: Reque...
import Vapor import HTTP import Foundation final class PostController: ResourceRepresentable { func index(request: Request) throws -> ResponseRepresentable { // get all the post objects from the database return try Post.all().makeNode().converted(to: JSON.self) } func create(request: Reque...
Update Table of Content for doc playground
/*: # FormationLayout ---- ![banner](banner.png) ## How To Use - Open **Documentation/Doc.xcworkspace**. - Build the **FormationLayout-iOS** scheme (⌘+B). - Open **Doc** playground in the **Project navigator**. - Click "Show Result" button at the most right side of each `demo` line. ![ShowResult](ShowR...
/*: # FormationLayout ---- ![banner](banner.png) ## How To Use - Open **Documentation/Doc.xcworkspace**. - Build the **FormationLayout-iOS** scheme (⌘+B). - Open **Doc** playground in the **Project navigator**. - Click "Show Result" button at the most right side of each `demo` line. ![ShowResult](ShowR...
Remove public param method, replace with paramAtIndex method.
public enum Method: String { case CONNECT case DELETE case GET case HEAD case OPTIONS case PATCH case POST case PUT case TRACE } public struct Request { let method: Method let path: Path let headers: [(String, String)] let body: String? // FIXME: Data instead? init(method: Method, path: Path, header...
public enum Method: String { case CONNECT case DELETE case GET case HEAD case OPTIONS case PATCH case POST case PUT case TRACE } public struct Request { let method: Method let path: Path let headers: [(String, String)] let body: String? // FIXME: Data instead? init(method: Method, path: Path, header...
Allow to pass objects around with slice model
// // PieSliceModel.swift // PieCharts // // Created by Ivan Schuetz on 30/12/2016. // Copyright © 2016 Ivan Schuetz. All rights reserved. // import UIKit public class PieSliceModel: CustomDebugStringConvertible { public let value: Double public let color: UIColor public init(value: Double, ...
// // PieSliceModel.swift // PieCharts // // Created by Ivan Schuetz on 30/12/2016. // Copyright © 2016 Ivan Schuetz. All rights reserved. // import UIKit public class PieSliceModel: CustomDebugStringConvertible { public let value: Double public let color: UIColor public let obj: Any? /// optiona...
Add a test of unapplied functions.
// Copyright (c) 2015 Rob Rix. All rights reserved. import Tesseract import XCTest final class EnvironmentTests: XCTestCase { func testNodeRepresentingConstantEvaluatesToConstant() { let a = Identifier() let graph = Graph(nodes: [ a: Node.Symbolic(Prelude["true"]!.0) ]) let evaluated = evaluate(graph, a) a...
// Copyright (c) 2015 Rob Rix. All rights reserved. import Tesseract import XCTest final class EnvironmentTests: XCTestCase { func testNodeRepresentingConstantEvaluatesToConstant() { let a = Identifier() let graph = Graph(nodes: [ a: Node.Symbolic(Prelude["true"]!.0) ]) let evaluated = evaluate(graph, a) a...
Document support for Swift 3 and 4
// swift-tools-version:3.1 import PackageDescription let package = Package( name: "Regex" )
// swift-tools-version:3.1 import PackageDescription let package = Package( name: "Regex", swiftLanguageVersions: [3, 4] )
Reset database before each test
import HTTP import Vapor import XCTest @testable import App class PostRequestTests: TestCase { let droplet = try! Droplet.testable() func testCreate() throws { let testContent = "test content" let requestBody = try Body(JSON(node: ["content": testContent])) let request = R...
import HTTP import Vapor import XCTest @testable import App class PostRequestTests: TestCase { let droplet = try! Droplet.testable() override func setUp() { super.setUp() try! Post.all().forEach { try $0.delete() } } func testCreate() throws { let testContent = "test c...
Test the elaboration of checked function types.
// Copyright © 2015 Rob Rix. All rights reserved. final class ElaborationTests: XCTestCase { func testInfersTheTypeOfType() { let term: Term = .Type assert(try? term.elaborateType(nil, [:], [:]), ==, .Unroll(.Type(1), .Identity(.Type(0)))) } } import Assertions import Manifold import XCTest
// Copyright © 2015 Rob Rix. All rights reserved. final class ElaborationTests: XCTestCase { func testInfersTheTypeOfType() { let term: Term = .Type assert(try? term.elaborateType(nil, [:], [:]), ==, .Unroll(.Type(1), .Identity(.Type(0)))) } func testChecksLambdasAgainstFunctionTypes() { assert(try? Term.La...
Add more CCGRect manipulation functions
import CoreGraphics /// Swift extensions to CGRect public extension CGRect { /// The rectangle stripped of any origin information, marking its bounds var bounds: CGRect { var bounds = self bounds.origin = CGPoint() return bounds } /// Convenience initializer to create a CGR...
import CoreGraphics /// Swift extensions to CGRect public extension CGRect { /// The rectangle stripped of any origin information, marking its bounds var bounds: CGRect { var bounds = self bounds.origin = CGPoint() return bounds } /// Convenience initializer to create a CGR...
Remove code to make starter project
import Foundation import XCPlayground XCPlaygroundPage.currentPage.needsIndefiniteExecution = true //: # Pollster //: __Challenge:__ Complete the following class to simulate a polling mechanism using `dispatch_after()` class Pollster { let callback: (String) -> () private var active: Bool = false private let i...
import Foundation import XCPlayground XCPlaygroundPage.currentPage.needsIndefiniteExecution = true //: # Pollster //: __Challenge:__ Complete the following class to simulate a polling mechanism using `dispatch_after()` class Pollster { let callback: (String) -> () init(callback: (String) -> ()) { self.callb...
Adjust socket buffer size to MTU and set deadline to forever
import UDP public class OSCServer: MessageDispatcher { public typealias Message = OSCMessage let socket: UDPSocket let dispatcher = OSCMessageDispatcher public init(port: Int) throws { socket = try UDPSocket(ip: IP(port: port)) } // override public func register(pattern: String, _ listener: @esca...
import UDP public class OSCServer: MessageDispatcher { public typealias Message = OSCMessage let socket: UDPSocket let dispatcher = OSCMessageDispatcher public init(port: Int) throws { socket = try UDPSocket(ip: IP(port: port)) } // override public func register(pattern: String, _ listener: @esca...
Add store property to app delegate
// // AppDelegate.swift // HomeControl // // Created by Julian Grosshauser on 06/11/15. // Copyright © 2015 Julian Grosshauser. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? = { let window = UIWindow(frame: UIScre...
// // AppDelegate.swift // HomeControl // // Created by Julian Grosshauser on 06/11/15. // Copyright © 2015 Julian Grosshauser. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { //MARK: Properties var window: UIWindow? = { let window ...
Edit comments to make them clearer.
// // Networking.swift // SwinjectMVVMExample // // Created by Yoichi Tagaya on 8/22/15. // Copyright © 2015 Swinject Contributors. All rights reserved. // import ReactiveCocoa public protocol Networking { /// Gets a `SignalProducer` emitting a JSON root element ( an array or dictionary). func requestJSON...
// // Networking.swift // SwinjectMVVMExample // // Created by Yoichi Tagaya on 8/22/15. // Copyright © 2015 Swinject Contributors. All rights reserved. // import ReactiveCocoa public protocol Networking { /// Returns a `SignalProducer` emitting a JSON root element ( an array or dictionary). func requestJ...
Add constant terms of a given value.
// Copyright (c) 2014 Rob Rix. All rights reserved. enum Term { case Parameter(String, Type) case Return(String, Type) }
// Copyright (c) 2014 Rob Rix. All rights reserved. enum Term { case Parameter(String, Type) case Return(String, Type) case Constant(Value) } enum Value { case Boolean(Swift.Bool) case Integer(Swift.Int) case String(Swift.String) }
Remove the assumption set return.
// Copyright (c) 2015 Rob Rix. All rights reserved. public func constraints(graph: Graph<Node>) -> (Term, assumptions: AssumptionSet, constraints: ConstraintSet) { let parameters = Node.parameters(graph) let returns = Node.returns(graph) let returnType: Term = reduce(returns, nil) { $0.0.map { .product(Term(), $0)...
// Copyright (c) 2015 Rob Rix. All rights reserved. public func constraints(graph: Graph<Node>) -> (Term, constraints: ConstraintSet) { let parameters = Node.parameters(graph) let returns = Node.returns(graph) let returnType: Term = reduce(returns, nil) { $0.0.map { .product(Term(), $0) } ?? Term() } ?? .Unit ret...
Add a Task convenience for unit tests
// // Fixtures.swift // DeferredTests // // Created by Zachary Waldowski on 6/10/15. // Copyright © 2014-2016 Big Nerd Ranch. Licensed under MIT. // import XCTest @testable import Deferred #if SWIFT_PACKAGE import Result #endif let TestTimeout: NSTimeInterval = 15 enum Error: ErrorType { case First case ...
// // Fixtures.swift // DeferredTests // // Created by Zachary Waldowski on 6/10/15. // Copyright © 2014-2016 Big Nerd Ranch. Licensed under MIT. // import XCTest @testable import Deferred #if SWIFT_PACKAGE import Result #endif let TestTimeout: NSTimeInterval = 15 enum Error: ErrorType { case First case ...
Remove non-ascii dash character from a comment.
//===----------------------------------------------------------------------===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LI...
//===----------------------------------------------------------------------===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LI...
Update transport to extend message transfer.
// // Transport.swift // Transport // // Created by Paul Young on 26/08/2014. // Copyright (c) 2014 CocoaFlow. All rights reserved. // import JSONLib public protocol Transport { /** Send a message from the runtime. :param: channel :param: topic :param: payload ...
// // Transport.swift // Transport // // Created by Paul Young on 26/08/2014. // Copyright (c) 2014 CocoaFlow. All rights reserved. // import MessageTransfer public protocol Transport: MessageSenderWorkaround { init(_ messageReceiver: MessageReceiverWorkaround) }
Mark package as macos only
// swift-tools-version:5.0 // Managed by ice import PackageDescription let package = Package( name: "Shout", products: [ .library(name: "Shout", targets: ["Shout"]), ], dependencies: [ .package(url: "https://github.com/IBM-Swift/BlueSocket", from: "1.0.46"), ], targets: [ ...
// swift-tools-version:5.0 // Managed by ice import PackageDescription let package = Package( name: "Shout", platforms: [ .macOS(.v10_10) ], products: [ .library(name: "Shout", targets: ["Shout"]), ], dependencies: [ .package(url: "https://github.com/IBM-Swift/BlueSocke...
Update SIL optimizer tests for Optional: Equatable conformance.
// RUN: %target-swift-frontend -enable-sil-ownership -sil-verify-all -primary-file %s -module-name=test -emit-sil -o - -verify | %FileCheck %s // CHECK-LABEL: sil {{.*}} @{{.*}}generic_func // CHECK: switch_enum_addr // CHECK: return func generic_func<T>(x: [T]?) -> Bool { return x == nil } // CHECK-LABEL: sil {{....
// RUN: %target-swift-frontend -enable-sil-ownership -sil-verify-all -primary-file %s -module-name=test -emit-sil -o - -verify | %FileCheck %s struct X { } // CHECK-LABEL: sil {{.*}} @{{.*}}generic_func // CHECK: switch_enum_addr // CHECK: return func generic_func<T>(x: [T]?) -> Bool { return x == nil } // CHECK-L...
Add font name to decorationPreference
// // DecorationPreference.swift // MercadoPagoSDK // // Created by Eden Torres on 1/16/17. // Copyright © 2017 MercadoPago. All rights reserved. // import Foundation open class DecorationPreference : NSObject{ var baseColor: UIColor = UIColor.purple var textColor: UIColor = UIColor.black var fontName...
// // DecorationPreference.swift // MercadoPagoSDK // // Created by Eden Torres on 1/16/17. // Copyright © 2017 MercadoPago. All rights reserved. // import Foundation open class DecorationPreference : NSObject{ var baseColor: UIColor = UIColor.purple var textColor: UIColor = UIColor.black var fontName...
Add fmap operator for List<T> and
// // Functor.swift // tibasic // // Created by Michael Welch on 7/22/15. // Copyright © 2015 Michael Welch. All rights reserved. // import Foundation func fmap<ParserA:ParserType, A, B where ParserA.TokenType==A>(f:A->B, _ t:ParserA) -> Parser<B> { return t.bind { success(f($0)) } } // Like Haskell fmap, <$...
// // Functor.swift // tibasic // // Created by Michael Welch on 7/22/15. // Copyright © 2015 Michael Welch. All rights reserved. // import Foundation func fmap<ParserA:ParserType, A, B where ParserA.TokenType==A>(f:A->B, _ t:ParserA) -> Parser<B> { return t.bind { success(f($0)) } } // Like Haskell fmap, <$...
Change delete and deleteAll type to Void
// MARK: - Delete public extension <%= model.name %> { var delete: Bool { get { let deleteSQL = "DELETE FROM \(<%= model.name %>.tableName) \(itself)" executeSQL(deleteSQL) return true } } static var deleteAll: Bool { get { return <%= model.relation_name ...
// MARK: - Delete public extension <%= model.name %> { var delete: Void { get { let deleteSQL = "DELETE FROM \(<%= model.name %>.tableName) \(itself)" executeSQL(deleteSQL) } } static var deleteAll: Void { get { return <%= model.relation_name %>().deleteAll } } } pu...
Remove unnecessary let for switch-case
// // VersionCommand.swift // SwiftCov // // Created by JP Simard on 2015-05-20. // Copyright (c) 2015 Realm. All rights reserved. // import Commandant import Result import SwiftCovFramework struct VersionCommand: CommandType { typealias ClientError = SwiftCovError let verb = "version" let function = ...
// // VersionCommand.swift // SwiftCov // // Created by JP Simard on 2015-05-20. // Copyright (c) 2015 Realm. All rights reserved. // import Commandant import Result import SwiftCovFramework struct VersionCommand: CommandType { typealias ClientError = SwiftCovError let verb = "version" let function = ...
Add support to indicate the bundle in which the Storyboard should be located
// // Storyboard.swift // BothamUI // // Created by Davide Mendolia on 03/12/15. // Copyright © 2015 GoKarumi S.L. All rights reserved. // import Foundation public struct BothamStoryboard { private let name: String public init(name: String) { self.name = name } private func storyboard(na...
// // Storyboard.swift // BothamUI // // Created by Davide Mendolia on 03/12/15. // Copyright © 2015 GoKarumi S.L. All rights reserved. // import Foundation public struct BothamStoryboard { private let name: String private let bundle: NSBundle public init(name: String, bundle: NSBundle = NSBundle.mai...
Add library path management in Application Manager
// // ApplicationManager.swift // ledger-wallet-ios // // Created by Nicolas Bigot on 13/02/2015. // Copyright (c) 2015 Ledger. All rights reserved. // import Foundation final class ApplicationManager: BaseManager { var UUID: String { if let uuid = preferences.stringForKey("uuid") { r...
// // ApplicationManager.swift // ledger-wallet-ios // // Created by Nicolas Bigot on 13/02/2015. // Copyright (c) 2015 Ledger. All rights reserved. // import Foundation final class ApplicationManager: BaseManager { //lazy private var logger = { return Logger.sharedInstance("ApplicationManager") }() ...
Add label to username associated value
// // ApiUrls.swift // GithubClient // // Created by Eduardo Arenas on 8/5/17. // Copyright © 2017 GameChanger. All rights reserved. // import Foundation enum ApiUrl { private static let baseURL = "https://api.github.com/" case user(String) case users var fullPath: String { switch self { case ...
// // ApiUrls.swift // GithubClient // // Created by Eduardo Arenas on 8/5/17. // Copyright © 2017 GameChanger. All rights reserved. // import Foundation enum ApiUrl { private static let baseURL = "https://api.github.com/" // Users case user(username: String) case users var fullPath: String { sw...
Update dependencies for Vapor 2
import PackageDescription let package = Package( name: "JWTKeychain", dependencies: [ .Package(url: "https://github.com/vapor/vapor.git", Version(2,0,0, prereleaseIdentifiers: ["beta"])), .Package(url: "https://github.com/vapor/mysql-provider.git", Version(2,0,0, prereleaseIdentifiers: ["beta"]...
import PackageDescription let package = Package( name: "JWTKeychain", dependencies: [ .Package(url: "https://github.com/vapor/vapor.git", majorVersion: 2), .Package(url: "https://github.com/vapor/mysql-provider.git", majorVersion: 2), // TODO: update url once PR is accepted .Pac...
Fix whitespaces for a closure
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -emit-sil -module-name coverage_member_closure %s | FileCheck %s class C { // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_member_closure.C.__allocating_init init() { if (false) { // CHECK: [[@LINE]]:16 -> [[@LINE+2]]:6 : 1 // ...
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -emit-sil -module-name coverage_member_closure %s | FileCheck %s class C { // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_member_closure.C.__allocating_init init() { if (false) { // CHECK: [[@LINE]]:16 -> [[@LINE+2]]:6 : 1 // ...
Make test-case for rdar://problem/20859567 slightly more complicated
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asserts struct Stringly { init(string: String) {} init(format: String, _ args: Any...) {} init(stringly: Stringly) {} } [Int](0..<1).map { print(Stringly(format: "%d: ", $0 * 2) + ["a", "b", "c", "d"][$0 *...
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asserts struct Stringly { init(string: String) {} init(format: String, _ args: Any...) {} init(stringly: Stringly) {} } [Int](0..<1).map { // expected-error@-1 {{expression was too complex to be solved in ...
Set log level to min
import UIKit import Firebase @UIApplicationMain class AppDelegate:UIResponder, UIApplicationDelegate { var window:UIWindow? func application( _ application:UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey:Any]?) -> Bool { Fireba...
import UIKit import Firebase @UIApplicationMain class AppDelegate:UIResponder, UIApplicationDelegate { var window:UIWindow? func application( _ application:UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey:Any]?) -> Bool { Fireba...
Make sure Route tests succeed
// // TestRoute.swift // SweetRouter // // Created by Oleksii on 17/03/2017. // Copyright © 2017 ViolentOctopus. All rights reserved. // import XCTest import SweetRouter class TestRoute: XCTestCase { func testUrlRouteEquatable() { XCTAssertEqual(URL.Route(path: ["myPath"], query: ("user", nil), (...
// // TestRoute.swift // SweetRouter // // Created by Oleksii on 17/03/2017. // Copyright © 2017 ViolentOctopus. All rights reserved. // import XCTest import SweetRouter class TestRoute: XCTestCase { func testUrlRouteEquatable() { XCTAssertEqual(URL.Route(path: ["myPath"], query: ("user", nil), (...
Fix patients view controller to actually display patients in the list.
// // BPETrackUsersViewController.swift // BPApp // // Created by Chris Blackstone on 4/24/17. // Copyright © 2017 BlackstoneBuilds. All rights reserved. // import UIKit class BPETrackUsersViewControler: UITableViewController { @IBAction func back() { dismiss(animated: true, completion: nil) ...
// // BPETrackUsersViewController.swift // BPApp // // Created by Chris Blackstone on 4/24/17. // Copyright © 2017 BlackstoneBuilds. All rights reserved. // import UIKit class BPETrackUsersViewControler: UITableViewController { @IBAction func back() { dismiss(animated: true, completion: nil) ...
Add initializer to NSRect by center point and size
// // NSRect+PointHelpers.swift // LinkedIdeas // // Created by Felipe Espinoza Castillo on 04/12/15. // Copyright © 2015 Felipe Espinoza Dev. All rights reserved. // import Cocoa extension NSRect { init(p1: NSPoint, p2: NSPoint) { origin = NSMakePoint(min(p1.x, p2.x), min(p1.y, p2.y)) size = NSSize(wid...
// // NSRect+PointHelpers.swift // LinkedIdeas // // Created by Felipe Espinoza Castillo on 04/12/15. // Copyright © 2015 Felipe Espinoza Dev. All rights reserved. // import Cocoa extension NSRect { init(p1: NSPoint, p2: NSPoint) { origin = NSMakePoint(min(p1.x, p2.x), min(p1.y, p2.y)) size = NSSize(wid...
Change how to update the FirebaseModel
// // Updatable+Extension.swift // FirebaseCommunity // // Created by Victor Alisson on 16/08/17. // import Foundation public extension Updatable where Self: FirebaseModel { func update(completion: @escaping (_ error: Error?) -> Void) { Self.path.updateChildValues(self.toJSON()) { (error, reference) in...
// // Updatable+Extension.swift // FirebaseCommunity // // Created by Victor Alisson on 16/08/17. // import Foundation public extension Updatable where Self: FirebaseModel { func update(completion: @escaping (_ error: Error?) -> Void) { guard let key = self.key else { return } ...
Remove unused change action in StackRoute for now
// // StackViewController.swift // Beeline // // Created by Karl Bowden on 5/01/2016. // Copyright © 2016 Featherweight Labs. All rights reserved. // import UIKit public class StackViewController: UINavigationController { public enum TransitionAction { case Pop(Segment) case Push(Segment) ...
// // StackViewController.swift // Beeline // // Created by Karl Bowden on 5/01/2016. // Copyright © 2016 Featherweight Labs. All rights reserved. // import UIKit public class StackViewController: UINavigationController { public enum TransitionAction { case Pop(Segment) case Push(Segment) ...
Make sendPost button the default
// // AdianTests.swift // AdianTests // // Created by Jeremy on 2015-12-02. // Copyright © 2015 Jeremy W. Sherman. All rights reserved. // import XCTest @testable import Adian class ComposePostViewControllerTests: XCTestCase { var composePostViewController: ComposePostViewController! override func s...
// // AdianTests.swift // AdianTests // // Created by Jeremy on 2015-12-02. // Copyright © 2015 Jeremy W. Sherman. All rights reserved. // import XCTest @testable import Adian class ComposePostViewControllerTests: XCTestCase { var composePostViewController: ComposePostViewController! override func s...
Fix build problem on linux
// Copyright (c) 2017 Timofey Solomko // Licensed under MIT License // // See LICENSE for license information import Foundation extension DataWithPointer { func getZipStringField(_ length: Int, _ useUtf8: Bool) -> String? { guard length > 0 else { return "" } let bytes = self.bytes(co...
// Copyright (c) 2017 Timofey Solomko // Licensed under MIT License // // See LICENSE for license information import Foundation #if os(Linux) import CoreFoundation #endif extension DataWithPointer { func getZipStringField(_ length: Int, _ useUtf8: Bool) -> String? { guard length > 0 else...
Update comments for stack with getMin().
// // Stack.swift // Stack GetMin() // // Created by Vyacheslav Khorkov on 16/08/2017. // Copyright © 2017 Vyacheslav Khorkov. All rights reserved. // import Foundation public struct Stack<T> { public var isEmpty: Bool { return array.isEmpty } public var count: Int { return array.count } public var top: T? {...
// // Stack.swift // Stack based on two arrays. // // Created by Vyacheslav Khorkov on 16/08/2017. // Copyright © 2017 Vyacheslav Khorkov. All rights reserved. // import Foundation // Stack based on two arrays. public struct Stack<Element: Comparable> { // Returns true if stack is empty. // Complexity: O(1) pu...
Fix assets not found (nil) when used as pod
// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen import Foundation import UIKit public extension UIImage { public enum SnapTagsViewAssets : String { case RedCloseButton = "RedCloseButton" case RoundedButton = "RoundedButton" case RoundedButton_WhiteWithGreyBorder = "R...
// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen import Foundation import UIKit private class classInSameBundleAsAssets: NSObject {} public extension UIImage { public enum SnapTagsViewAssets : String { case RedCloseButton = "RedCloseButton" case RoundedButton = "RoundedB...
Add a test with a mock HTTP response
// // vidal_api_swiftTests.swift // vidal-api.swiftTests // // Created by Jean-Christophe GAY on 31/01/2015. // Copyright (c) 2015 Vidal. All rights reserved. // import Foundation import XCTest import VidalApi class HelloVidalTests: XCTestCase { override func setUp() { super.setUp() } ...
// // vidal_api_swiftTests.swift // vidal-api.swiftTests // // Created by Jean-Christophe GAY on 31/01/2015. // Copyright (c) 2015 Vidal. All rights reserved. // import Foundation import XCTest import VidalApi class HelloVidalTests: XCTestCase { override func setUp() { super.setUp() } ...
Add methods required for cartoons mode.
// // Residue.swift // IMVS // // Created by Allistair Crossley on 13/07/2014. // Copyright (c) 2014 Allistair Crossley. All rights reserved. // import Foundation /** * Amino Acid Residue * * A protein chain will have somewhere in the range of 50 to 2000 amino acid residues. * You have to use this term becau...
// // Residue.swift // IMVS // // Created by Allistair Crossley on 13/07/2014. // Copyright (c) 2014 Allistair Crossley. All rights reserved. // import Foundation /** * Amino Acid Residue * * A protein chain will have somewhere in the range of 50 to 2000 amino acid residues. * You have to use this term becau...
Add jsonArray property on Array with JSONRepresentable elements
// // JSONArray.swift // SwiftyJSONModel // // Created by Oleksii on 21/09/2016. // Copyright © 2016 Oleksii Dykan. All rights reserved. // import Foundation import SwiftyJSON public struct JSONArray<T> where T: JSONInitializable & JSONRepresentable { public let array: [T] public init(_ array: [T]) {...
// // JSONArray.swift // SwiftyJSONModel // // Created by Oleksii on 21/09/2016. // Copyright © 2016 Oleksii Dykan. All rights reserved. // import Foundation import SwiftyJSON public struct JSONArray<T> where T: JSONInitializable & JSONRepresentable { public let array: [T] public init(_ array: [T]) {...
Update dependencies (S4 0.8, URI 0.8)
import PackageDescription let package = Package( name: "HTTPParser", dependencies: [ .Package(url: "https://github.com/Zewo/CHTTPParser.git", majorVersion: 0, minor: 5), .Package(url: "https://github.com/Zewo/URI.git", majorVersion: 0, minor: 7), .Package(url: "https://github.com/open-swift/S...
import PackageDescription let package = Package( name: "HTTPParser", dependencies: [ .Package(url: "https://github.com/Zewo/CHTTPParser.git", majorVersion: 0, minor: 5), .Package(url: "https://github.com/Zewo/URI.git", majorVersion: 0, minor: 8), .Package(url: "https://github.com/open-swift/S...
Use a currency formatter to display the gift's price
// // GiftCell.swift // Babies // // Created by phi161 on 27/05/16. // Copyright © 2016 Stanhope Road. All rights reserved. // import UIKit class GiftCell: UITableViewCell { @IBOutlet var titleLabel: UILabel! @IBOutlet var dateLabel: UILabel! @IBOutlet var currencyLabel: UILabel! func updat...
// // GiftCell.swift // Babies // // Created by phi161 on 27/05/16. // Copyright © 2016 Stanhope Road. All rights reserved. // import UIKit class GiftCell: UITableViewCell { @IBOutlet var titleLabel: UILabel! @IBOutlet var dateLabel: UILabel! @IBOutlet var currencyLabel: UILabel! func updat...
Remove minor version from generic branch
import PackageDescription let package = Package( name: "GIO", dependencies: [ .Package(url: "https://github.com/rhx/SwiftGObject.git", majorVersion: 2, minor: 46) ] )
import PackageDescription let package = Package( name: "GIO", dependencies: [ .Package(url: "https://github.com/rhx/SwiftGObject.git", majorVersion: 2) ] )
Add warning not to add anything to the identifier-at-eof test
// RUN: %incr-transfer-tree --expected-incremental-syntax-tree %S/Outputs/extend-identifier-at-eof.json %s func foo() {} _ = x<<<|||x>>>
// RUN: %incr-transfer-tree --expected-incremental-syntax-tree %S/Outputs/extend-identifier-at-eof.json %s func foo() {} // ATTENTION: This file is testing the EOF token. // DO NOT PUT ANYTHING AFTER THE CHANGE, NOT EVEN A NEWLINE _ = x<<<|||x>>>
Fix request's multipart data getter
extension Request { /** Multipart encoded request data sent using the `multipart/form-data...` header. Used by web browsers to send files. */ public var multipart: [String: Multipart]? { if let existing = storage["multipart"] as? [String: Multipart]? { return exi...
extension Request { /** Multipart encoded request data sent using the `multipart/form-data...` header. Used by web browsers to send files. */ public var multipart: [String: Multipart]? { if let existing = storage["multipart"] as? [String: Multipart] { return exis...
Add parent to user item
import Foundation class MFirebaseDUserItem:MFirebaseDProtocol { let identifier:String? required init?(snapshot:Any?, identifier:String?) { self.identifier = identifier } }
import Foundation class MFirebaseDUserItem:MFirebaseDProtocol { let identifier:String? var parent:MFirebaseDProtocol? { get { let userList:MFirebaseDUser? = MFirebaseDUser( snapshot:nil, identifier:nil) return userLis...
Use constants for time conversions
import Darwin.POSIX import Dispatch import struct Foundation.TimeInterval func sleep(for timeInterval: TimeInterval) { let microSeconds: useconds_t = .init(timeInterval * 1_000_000) usleep(microSeconds) } extension DispatchGroup { func wait(for timeInterval: TimeInterval) -> DispatchTimeoutResult { let dispatchT...
import Darwin.POSIX import Dispatch import struct Foundation.TimeInterval func sleep(for timeInterval: TimeInterval) { let microSeconds: useconds_t = .init(timeInterval * Double(USEC_PER_SEC)) usleep(microSeconds) } extension DispatchGroup { func wait(for timeInterval: TimeInterval) -> DispatchTimeoutResult { le...
Disable new SwiftToCxxToSwift Interop test
// RUN: %empty-directory(%t) // RUN: split-file %s %t // RUN: touch %t/swiftMod.h // RUN: %target-swift-frontend -typecheck %t/swiftMod.swift -typecheck -module-name SwiftMod -emit-clang-header-path %t/swiftMod.h -I %t -enable-experimental-cxx-interop // RUN: %FileCheck %s < %t/swiftMod.h // RUN: %target-swift-front...
// RUN: %empty-directory(%t) // RUN: split-file %s %t // RUN: touch %t/swiftMod.h // RUN: %target-swift-frontend -typecheck %t/swiftMod.swift -typecheck -module-name SwiftMod -emit-clang-header-path %t/swiftMod.h -I %t -enable-experimental-cxx-interop // RUN: %FileCheck %s < %t/swiftMod.h // RUN: %target-swift-front...
Load user avatar file and display it as a circle.
// // FriendUserCell.swift // RoadTripPlanner // // Created by Diana Fisher on 10/23/17. // Copyright © 2017 RoadTripPlanner. All rights reserved. // import UIKit import Parse class FriendUserCell: UITableViewCell { @IBOutlet weak var avatarImageView: UIImageView! @IBOutlet weak var usernameLabel: UILabe...
// // FriendUserCell.swift // RoadTripPlanner // // Created by Diana Fisher on 10/23/17. // Copyright © 2017 RoadTripPlanner. All rights reserved. // import UIKit import Parse class FriendUserCell: UITableViewCell { @IBOutlet weak var avatarImageView: UIImageView! @IBOutlet weak var usernameLabel: UILabe...