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 CoreLocation | |
class LocationManager: NSObject, CLLocationManagerDelegate { | |
//MARK: Object to Access Location Services | |
private let locationManager = CLLocationManager() | |
//MARK: Set up the Location Manager Delegate | |
override init() { | |
super.init() |
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 SwiftUI | |
import SpriteKit | |
protocol SquareGameLogicDelegate { | |
var totalScore: Int { get } | |
mutating func addPoint() -> Void | |
} | |
// 1. Conform the ContentView to the SquareLogicDelegate protocol |
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
struct Product { | |
let name: String | |
let type: String | |
let description: String | |
let imageName: String | |
} | |
struct ProductPageView: View { | |
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
// CoffeeTimeApp.swift | |
// Created by Tiago Pereira on 23/07/21. | |
import SwiftUI | |
@main | |
struct CoffeeTimeApp: App { | |
// 8. Set up our class as the application delegate | |
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate |
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
// Xcode 13 + iOS 15 | |
struct CareKitDetailedCardView: View { | |
var body: some View { | |
VStack(alignment: .leading) { | |
// The header of the card | |
// - Photo, Full Name and Professional Title | |
HStack { | |
Circle() | |
.frame(width: 40, height: 40) | |
.foregroundColor(.gray) |
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
/* | |
O que é um Property List (PList)? | |
- Ref: [Apple: About Info.plist](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html) | |
- Ref: [Apple: Introduction to Property Lists](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html) | |
- Ref: [](https://makeapppie.com/2016/02/11/how-to-use-property-lists-plist-in-swift/) | |
É um tipo de arquivo que pode armazenar informações de maneira estruturada. | |
Um plist é um arquivo que utiliza um notação XML para organizar a informação. | |
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
// Create the Activity Indicator | |
let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) | |
// Add it to the view where you want it to appear | |
view.addSubview(activityIndicator) | |
// Set up its size (the super view bounds usually) | |
activityIndicator.frame = view.bounds | |
// Start the loading animation | |
activityIndicator.startAnimating() |
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
/*: | |
## Tutorial de UIPageViewController | |
Referências: | |
- [How to Use UIPageViewController in Swift 2.2](https://spin.atomicobject.com/2015/12/23/swift-uipageviewcontroller-tutorial/) | |
- [How to Move Page Dots in a UIPageViewController with Delegation](https://spin.atomicobject.com/2016/02/11/move-uipageviewcontroller-dots/) | |
- [](https://developer.apple.com/reference/uikit/uipageviewcontroller) | |
- [](https://developer.apple.com/reference/uikit/uipageviewcontrollerdatasource) | |
- [](https://developer.apple.com/reference/uikit/uipageviewcontrollerdelegate) | |
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
// The code bellow must be written in your Table View Controller | |
// Remember to use your own classes and properties when creating your own search. | |
// 1. Create a new property in your class | |
// The Search Controller is the responsible to do the "searching magic" | |
let searchController = UISearchController(searchResultsController: nil) | |
// 2. At the viewDidLoad() add those initializations | |
searchController.searchResultsUpdater = self // You will get an error here for now, but it will vanish at step number 5 | |
searchController.dimsBackgroundDuringPresentation = 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
// 1. Creating the AlertController | |
let alert: UIAlertController = UIAlertController(title: "Teste", | |
message: "Aprendendo a fazer alertas", | |
preferredStyle: .alert) | |
// 1.1. Create the actions | |
let okAction = UIAlertAction(title: "OK", style: .default) { (okAction) in | |
// Insert here the code to be executed when the user select the action | |
print("O usuário escolheu: \(okAction.title!)") | |
} |
NewerOlder