This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import PackageDescription | |
| let package = Package( | |
| name: "example", | |
| dependencies: [ | |
| .Package(url: "https://github.com/marciok/CRuby", majorVersion: 1) | |
| ] | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module CRuby { | |
| header "/usr/local/var/rbenv/versions/2.2.5/include/ruby-2.2.0/ruby.h" // If it can't find ,check where rbenv is installed: echo $RBENV_ROOT | |
| link "ruby" | |
| export * | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Addition without `+` operator | |
| // | |
| func sum(n1: Int, n2: Int) -> Int { | |
| let result = n1 ^ n2 | |
| let carry = (n1 & n2) << 1 | |
| if carry != 0 { | |
| return sum(result, n2: carry) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Tic-Tac-Toe game written in Swift using a functional programming approach. | |
| import UIKit | |
| struct Board { | |
| let field: [[String]] | |
| let currentState: State | |
| init(field: [[String]], currentState: State) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Pony { | |
| // Now with final | |
| func final genus() -> String { | |
| return "Equus" | |
| } | |
| } | |
| print(Pony().genus()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Unicorn { | |
| final func numbersOfHorns() -> Int { | |
| return 1 | |
| } | |
| } | |
| // If we try to override the method. | |
| class Horse: Unicorn { | |
| override func numbersOfHorns() -> Int { // ERROR: Instance method overrides a 'final' instance method |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Multi line comments were added by me (Marcio) the single lines were added by swiftc | |
| **/ | |
| sil_stage raw | |
| import Builtin | |
| import Swift | |
| import SwiftShims |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Multi line comments were added by me (Marcio) the single lines were added by swiftc | |
| **/ | |
| sil_stage raw | |
| import Builtin | |
| import Swift | |
| import SwiftShims |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Pony { | |
| // WITHOUT final | |
| func genus() -> String { | |
| return "Equus" | |
| } | |
| } | |
| print(Pony().genus()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| key_chain=ios-build.keychain | |
| security create-keychain -p travis $key_chain | |
| # Make the keychain the default so identities are found | |
| security default-keychain -s $key_chain | |
| # Unlock the keychain | |
| security unlock-keychain -p travis $key_chain | |
| # Set keychain locking timeout to 3600 seconds |