Skip to content

Instantly share code, notes, and snippets.

View MoralAlberto's full-sized avatar

Alberto MoralAlberto

View GitHub Profile
struct ContentView: View {
@State private var animate = false
var body: some View {
AppleLogo()
.trim(from: 0.0, to: animate ? 1.0 : 0.0)
.stroke(
LinearGradient(gradient: Gradient(colors: [.purple, .blue, .green, .orange]),
startPoint: .bottomLeading,
endPoint: .topTrailing),
/**
* SwiftShell
* Copyright (c) 2017 Alberto Moral
* Licensed under the MIT license, see LICENSE file
*/
import Foundation
extension Process {
public func shell(command: String) -> String {
//
// ViewController.swift
// StackViews
//
// Created by Alberto Moral on 07/05/2017.
// Copyright © 2017 Alberto Moral. All rights reserved.
//
import UIKit
var arrayA = ["1", "2", "3", "4"]
let arrayB = arrayA
let arrayC = arrayA
print("Array B = Array A")
print("Array C = Array A")
print("Array A reference \(UnsafeMutableRawPointer(mutating: arrayA))")
print("Array B reference \(UnsafeMutableRawPointer(mutating: arrayB))")
print("Array C reference \(UnsafeMutableRawPointer(mutating: arrayC))")
print("If I change the value of Array A adding:")
require "thor"
class MyCLI < Thor
desc "hello NAME", "say hello to NAME"
def hello(name, from = nil)
puts "Hello #{name}"
puts "from #{from}" if from
end
end
require 'xcodeproj'
project_name = "New_Project"
project_path = "./New_Project.xcodeproj"
project = Xcodeproj::Project.new(project_path)
project.save()
project.new_target(:application, "New_Project", :ios, "10.0")
project.save()
func marvelCharacter() {
API.characters(pageSize, offset: offset)
.throttle(2.0, onScheduler: QueueScheduler.mainQueueScheduler)
.on(failed: { error in
// Handle Server Error
})
.startWithNext { [unowned self] characters in
self.canReloadUI = true
}
}
class HeroesCollectionViewController: UICollectionViewController {
var viewModel = HeroesCollectionViewModel()
...
override func viewDidLoad() {
super.viewDidLoad()
binding()
viewModel.marvelCharacter()
var publicationCell = tableView.dequeueReusableCellWithIdentifier("publicatonCell") as PublicationCell
publicationCell.configureWithPublication(user)
protocol Freak {
func isFreak() -> Bool
}
class Moral: Developer, Freak {
func isFreak() -> Bool {
return true
}
}