This file contains 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
extension String { | |
func withHighlightedText(highlightedPartsOfString: Array<NSString>, font: UIFont, newFont: UIFont) -> NSAttributedString { | |
let nonHighlightedFontAttribute = [NSAttributedString.Key.font:font] | |
let highlightedFontAttribute = [NSAttributedString.Key.font:newFont] | |
let newText = NSMutableAttributedString(string: self as String, attributes: nonHighlightedFontAttribute) | |
for i in 0 ..< highlightedPartsOfString.count { | |
newText.addAttributes(highlightedFontAttribute, range: (self as NSString).range(of: highlightedPartsOfString[i] as String)) | |
} | |
return newText | |
} |
This file contains 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
function contem(array, numero) { | |
var result = array.indexof(numero); | |
if (result != -1) { | |
return true; | |
} | |
return false; | |
} |
This file contains 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
NSString *agency = @"1234"; | |
NSString *account = @"1234"; | |
int count01 = [agency length]; | |
int count03 = [account length]; | |
if (count01+count03 < 12) { | |
NSString *newStr = agency; | |
int countDown = 12 - (count01 + count03); | |
for (int i = 1; i <= countDown; i++) { |
This file contains 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
init(fromJSON json: JSON) { | |
// tinha que alterar esse init: | |
let result = json["result"] | |
self.id = result["id"].stringValue | |
self.name = result["nome"].stringValue | |
self.token = result["token"].stringValue | |
self.email = result["usuario"].stringValue | |
self.cpf = result["cpf"].stringValue | |
self.password = result["senha"].stringValue |
This file contains 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
static func signin(_ data: URLRequestParams, success: @escaping (User) -> Void, failure: @escaping (ApiError) -> Void ){ | |
var data = URLRequestParams() | |
data["usuario"] = "nayanne.moritsuka+tcr6@terras.agr.br" | |
data["senha"] = "1234" | |
// da um break na linha abaixo, e ve se a variavel data ta populada | |
Alamofire.request(Router.login(data: data)) | |
.validate() | |
.responseJSON { response in | |
switch response.result { | |
case .success: |
This file contains 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
func asURLRequest() throws -> URLRequest { | |
let url: URL | |
if path == "estimates" || path == "users"{ | |
url = try Router.routeResults.asURL() | |
} else { | |
url = try Router.routeGoogle.asURL() | |
} | |
var urlRequest = URLRequest(url: url.appendingPathComponent(path)) | |
urlRequest.httpMethod = method.rawValue | |
if hearders != ""{ |
This file contains 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
// MARK: - Paths | |
var hearders: String { | |
if path == "estimates" || path == "users"{ | |
return "103260408667b5727f0bc10dc37240b2d38579051d9924b979ea2e4fe3a31635802b3b4ff8e25d31b39066957a8c3811c9f427e0d8a4c8c0bc58916fc3ea1be6" | |
} | |
return "" | |
} |
This file contains 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
// | |
// BaseApiClient.swift | |
// Melhor Corrida | |
// | |
// Created by Paulo Rosa on 07/08/17. | |
// Copyright © 2017 Paulo Rosa. All rights reserved. | |
// | |
//swiftlint:disable empty_enum_arguments | |
import UIKit | |
import Alamofire |
This file contains 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
excluded: # paths to ignore during linting. Takes precedence over `included`. | |
- Carthage | |
- Pods | |
- Source/ExcludedFolder | |
- Source/ExcludedFile.swift | |
# rules that have both warning and error levels, can set just the warning level | |
# implicitly | |
line_length: 250 |
This file contains 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
excluded: # paths to ignore during linting. Takes precedence over `included`. | |
- Carthage | |
- Pods | |
- Source/ExcludedFolder | |
- Source/ExcludedFile.swift | |
# rules that have both warning and error levels, can set just the warning level | |
# implicitly | |
line_length: 250 |
NewerOlder