Skip to content

Instantly share code, notes, and snippets.

View victorpanitz's full-sized avatar
📱

Victor Panitz Magalhães victorpanitz

📱
  • iFood
  • Porto Alegre
View GitHub Profile
function layer(context, selectedLayer) {
let object = '';
let result = {};
let x = Math.floor(selectedLayer.rect.x);
let y = Math.floor(selectedLayer.rect.y);
let width = Math.floor(selectedLayer.rect.width);
let height = Math.floor(selectedLayer.rect.height);
let rect = "CGRect(x: " + x + ", y: " + y + ", width: " + width + ", height: "+ height + ")";
// Add an "Add to Siri" button to a view.
func addSiriButton(to view: UIView) {
let button = INUIAddVoiceShortcutButton(style: .blackOutline)
button.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(button)
view.centerXAnchor.constraint(equalTo: button.centerXAnchor).isActive = true
view.centerYAnchor.constraint(equalTo: button.centerYAnchor).isActive = true
button.addTarget(self, action: #selector(addToSiri(_:)), for: .touchUpInside)
//
// SeriesSuggestionIntent.swift
//
// This file was automatically generated and should not be edited.
//
#if canImport(Intents)
import Intents
@available(iOS 12.0, watchOS 5.0, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@objc(SeriesSuggestionIntentHandling)
public protocol SeriesSuggestionIntentHandling: NSObjectProtocol {}
func testEmailIsValid() {
XCTAssert(inputedEmail.isValid())
}
func test_EmailIsValid_GivenInputIsEmpty_ShouldReturnFalse() {
let inputedEmail = ""
XCTAssertEqual(inputedEmail.isValid(), false)
}
func validation(valueA: Bool?, valueB: Bool?, valueC: Bool?) {
guard
let a = valueA,
let b = valueB,
let c = valueC,
b,!c
else {
view.showError("error")
return
}
func test_validation_given_valueAIsNotNil_valueBIsNotNilAndTrue_valueCIsNotNilAndFalse_ShouldReturnTrue() {
sut.validation(valueA: false, valueB: true, valueC: false)
XCTAssertEqual(view.setupCalled, true)
XCTAssertEqual(view.setupAPassed, false)
XCTAssertEqual(view.setupBPassed, true)
XCTAssertEqual(view.setupCPassed, false)
}
class TableOfContentsSpec: QuickSpec {
override func spec() {
describe("the 'Documentation' directory") {
it("has everything you need to get started") {
let sections = Directory("Documentation").sections
expect(sections).to(contain("Organized Tests with Quick Examples and Example Groups"))
expect(sections).to(contain("Installing Quick"))
}
context("if it doesn't have what you're looking for") {
extension XCTContext {
/// Create and run a new activity with provided name and block.
public class func runActivity<Result>(named name: String, block: (XCTActivity) throws -> Result) rethrows -> Result
}