37
Ser fanboy não compen$a

Bibliotecas Google para iOS: Fanboy é a sua vó

Embed Size (px)

Citation preview

Ser fanboy não compen$a

Ser fanboy não compen$a

Bibliotecas Google para iOS Fanboy é a sua vóMarcelo Quinta

https://developers.google.com/ios/ 2015

https://developers.google.com/ios/ 2017

Xcode 8 iOS 10

$ pod try Google

Adicione de acordo com a necessidade

Google Mapspod 'GoogleMaps'

Google Mapspod 'GoogleMaps'

Google Mapspod 'GoogleMaps'

Google Mapspod 'GoogleMaps'

Fazer o Estilo Abrir JSON de configuração Carregar o mapa

https://mapstyle.withgoogle.com/

Google Mapspod 'GoogleMaps'

import UIKit import GoogleMaps

class ViewController: UIViewController, GMSMapViewDelegate {

override func loadView() { let panoView = GMSPanoramaView(frame: .zero) self.view = panoView

panoView.moveNearCoordinate(CLLocationCoordinate2D( latitude: -33.732, longitude: 150.312)) } }

Google Mapspod ‘GoogleMaps'

pod ‘Google-Maps-iOS-Utils‘

Google Placespod 'GooglePlaces' • Mesmo setup do Maps

• 1000 requisições por dia

pod ‘Firebase/Core'

pod ‘Firebase/Core'

Analytics para iOS

pod 'Firebase/Core'

pod ‘Firebase/Core'

Banco de dados em “tempo real"pod ‘Firebase/Database'

var ref: FIRDatabaseReference!

ref = FIRDatabase.database().reference()

self.ref.child("users/(user.uid)/username").setValue(username)

ref.child("users").child(userID!).observeSingleEvent(of: .value, with: { (snapshot) in // Get user value let value = snapshot.value as? NSDictionary let username = value?["username"] as? String ?? "" let user = User.init(username: username)

// ... }) { (error) in print(error.localizedDescription) }

Firebase Cloud Messaging

Não esquecer de pedir autorização no Delegate

pod ‘Firebase/Core’ pod ‘Firebase/Messaging’

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) {  UIUserNotificationType allNotificationTypes =  (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);  UIUserNotificationSettings *settings =  [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];  [[UIApplication sharedApplication] registerUserNotificationSettings:settings];} else {  // iOS 10 or later  #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0  // For iOS 10 display notification (sent via APNS)  [UNUserNotificationCenter currentNotificationCenter].delegate = self;  UNAuthorizationOptions authOptions =      UNAuthorizationOptionAlert      | UNAuthorizationOptionSound      | UNAuthorizationOptionBadge;  [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions completionHandler:^(BOOL granted, NSError * _Nullable error) {      }];

  // For iOS 10 data message (sent via FCM)  [FIRMessaging messaging].remoteMessageDelegate = self;  #endif}

[[UIApplication sharedApplication] registerForRemoteNotifications];

Tópico é vida

Tag Manager Remote Configpod ‘Firebase/RemoteConfig'

remoteConfig = FIRRemoteConfig.remoteConfig() let remoteConfigSettings = FIRRemoteConfigSettings(developerModeEnabled: true) remoteConfig.configSettings = remoteConfigSettings!

remoteConfig.setDefaultsFromPlistFileName(“RemoteConfigDefaults")

remoteConfig.fetch(withExpirationDuration: TimeInterval(expirationDuration)) { (status, error) -> Void in if status == .success { print("Config fetched!") self.remoteConfig.activateFetched() } else { print("Config not fetched") print("Error \(error!.localizedDescription)") } self.displayWelcome() }

var welcomeMessage = remoteConfig[welcomeMessageConfigKey].stringValue

Install Ads e Admobpod ‘Firebase/AdMob'

Invitespod ‘Firebase/Invites'

- (IBAction)inviteTapped:(id)sender {   id<FIRInviteBuilder> inviteDialog = [FIRInvites inviteDialog];   [inviteDialog setInviteDelegate:self];

  // NOTE: You must have the App Store ID set in your developer console project   // in order for invitations to successfully be sent.   NSString *message =       [NSString stringWithFormat:@"Try this out!\n -%@",                                  [GIDSignIn sharedInstance].currentUser.profile.name];

  // A message hint for the dialog. Note this manifests differently depending on the   // received invitation type. For example, in an email invite this appears as the subject.   [inviteDialog setMessage:message];

  // Title for the dialog, this is what the user sees before sending the invites.   [inviteDialog setTitle:@"Invites Example"];   [inviteDialog setDeepLink:@"app_url"];   [inviteDialog setCallToActionText:@"Install!"];   [inviteDialog setCustomImage:@"https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"];   [inviteDialog open]; }

Invitespod ‘Firebase/Invites'

APIs "alternativas" (mas ainda do Google)

Mó esquisitão você

Google Castpod ‘google-cast-sdk‘

https://github.com/googlecast/CastHelloText-ios

Cardboardpod ‘GVRSDK'

https://developers.google.com/vr/ios/get-started

Mais informações

Route 85

http://bit.ly/route85

Google APIs para iOS

https://developers.google.com/ios/

Firebase in a Weekend by Google: iOS http://bit.ly/FirebaseiOSWeekend

Tks @ToddKerpelman!

Marcelo Quinta@mrquinta

Obrigado!