Skip to content

Instantly share code, notes, and snippets.

View LeoAOliveira's full-sized avatar

Leonardo Amorim de Oliveira LeoAOliveira

View GitHub Profile
@LeoAOliveira
LeoAOliveira / PointerInView.swift
Created April 7, 2020 17:44
Detecção do cursor em uma view
class ViewController: UIViewController {
@IBOutlet var button: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
let hover = UIHoverGestureRecognizer(target: self, action: #selector(hovering(_:)))
button.addGestureRecognizer(hover)
@LeoAOliveira
LeoAOliveira / TranslucentBackground.swift
Created April 7, 2020 16:26
Fundo translúcido para a View Controller primária
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let splitViewController = window!.rootViewController as! UISplitViewController
let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem
// Add a translucent background to the primary view controller.
splitViewController.primaryBackgroundStyle = .sidebar
splitViewController.delegate = self
@LeoAOliveira
LeoAOliveira / CompilationCondition.swift
Created April 7, 2020 15:58
Condição de compilação para Mac Catalyst
#if targetEnvironment(macCatalyst)
// código referente ao macOS
#else
// código referente ao iOS
#endif
Logos Simulador Suporte
Contato pelo email leonardo.aoliveira@icloud.com
@LeoAOliveira
LeoAOliveira / gist:b8a277e53db264f1e6584280492176f4
Created August 8, 2019 02:27
Logos Simulador Privacy Policy
Logos Simulador Privacy Policy
Information on the app
We do not collect any data from our users. The only data used for the app functionalities
are stored within the phone. At any moment you can delete the data in the app by deleting the app.
// Retorna a altura das linhas da tabela.
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 250
}
// Retorna o número de itens para a collection.
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 3
}
// Provém um objeto de célula para cada item.
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
// Parte 1: Buscar uma célula do tipo apropriado.
let cellCollection = collectionView.dequeueReusableCell(withReuseIdentifier: "collectionCell", for: indexPath) as! CollectionViewCell
import UIKit
class CollectionViewCell: UICollectionViewCell {
@IBOutlet weak var collectionViewTextLabel: UILabel!
}
// MARK: - Table View
// Provém um objeto de célula para cada linha.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// Parte 1: Buscar uma célula do tipo apropriado.
let cell = tableView.dequeueReusableCell(withIdentifier: "tableCell", for: indexPath) as! TableViewCell
// Parte 2: Configurar o conteúdo da célula.
cell.titleLabel!.text = "Título"
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource {
// ...
}