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: - Keyboard | |
@IBAction func hideKeyboard(_ sender: Any) { | |
self.view.endEditing(true) | |
} |
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 selectedTheAnimal(animal: Animal) { | |
let alert = UIAlertController(title: animal.name.uppercased(), message: "Selected the: \(animal.name)", preferredStyle: .alert) | |
let action = UIAlertAction(title: "OK", style: .cancel, handler: nil); | |
alert.addAction(action) | |
self.present(alert, animated: true, completion: nil) | |
} |
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
import UIKit | |
class FirstViewController: UIViewController, SecondViewControllerProtocol { | |
// MARK: - Navigation | |
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | |
if segue.identifier == "FirstToSecondSegue" { | |
if let vc = segue.destination as? SecondViewControllerProtocol { | |
vc.delegate = self | |
} |
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
import UIKit | |
protocol SecondViewControllerProtocol { | |
func didDoSomethingOnSecondViewController(message: String) | |
} | |
class SecondViewController: UIViewController { | |
//MARK: - Variables | |
var delegate: SecondViewControllerProtocol? |
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
import UIKit | |
class ViewController: UIViewController { | |
// MARK: - IBOutlets | |
@IBOutlet weak var tableView: UITableView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. |
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 ViewController : UITableViewDataSource { | |
//1 - primeiro método obrigatório | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return 10 | |
} | |
//2 - segundo método obrigatório | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
//3 - crie uma célula com o mesmo identificador de quando registramos a classe | |
let cell = tableView.dequeueReusableCell(withIdentifier: "tableCell", for: indexPath) |
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 ViewController : UITableViewDelegate { | |
//1 - método chamado quando uma linha é selecionada | |
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | |
tableView.deselectRow(at: indexPath, animated: true) | |
} | |
//2 - método para definir a altura de cada linha | |
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | |
return 44 | |
} |
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 getName() -> String { | |
return "Yasmin Benatti" | |
} | |
func helloWorld() { | |
print("Hello " + getName()) | |
} | |
helloWorld() |
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 *)getName { | |
return @"Yasmin Benatti"; | |
} | |
- (void)helloWorld { | |
NSLog(@"Hello %@", [self getName]); | |
} | |
[self helloWorld]; |
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
# | |
# Be sure to run `pod spec lint uFeature.podspec' to ensure this is a | |
# valid spec and to remove all comments including this before submitting the spec. | |
# | |
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html | |
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ | |
# | |
Pod::Spec.new do |s| | |
s.name = 'uFeature' |