Skip to content

Instantly share code, notes, and snippets.

View MaatheusGois's full-sized avatar
:octocat:
Hi

Matheus Gois MaatheusGois

:octocat:
Hi
View GitHub Profile
function pullJSON() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var sheet = ss.getActiveSheet();
var url="http://br-acampa-abu.herokuapp.com/compras/api/"; // Paste your JSON URL here
var response = UrlFetchApp.fetch(url); // get feed
var dataAll = JSON.parse(response.getContentText()); //
import UIKit
extension UIImageView {
public func imageFromServerURL(urlString: String, completion: @escaping (String?, Error?) -> Void) {
self.image = nil
print(urlString)
let urlStringNew = urlString.replacingOccurrences(of: " ", with: "%20")
URLSession.shared.dataTask(with: NSURL(string: urlStringNew)! as URL, completionHandler: { (data, response, error) -> Void in
if error != nil {
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions
launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//=====================ADD ESSAS LINHAS====================
//Quando a notificacao é respondida
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler:
@escaping () -> Void) {
//--------------------------Linhas Adicionadas----------------------------
//Chamando identificador de ações
let identificador = response.actionIdentifier
func enviarNotificacao(_ titulo:String, _ subtitulo:String, _ mensagem:String,
_ identificador:String, _ tempo:TimeInterval) {
//Essa instancia de classe é necessária para criar o corpo da notificação
let contexto = UNMutableNotificationContent()
//Criando corpo da notificação
contexto.title = titulo
contexto.subtitle = subtitulo
contexto.body = mensagem
func enviarNotificacao(_ titulo:String, _ subtitulo:String, _ mensagem:String,
_ identificador:String, _ tempo:TimeInterval) {
//Essa instancia de classe é necessária para criar o corpo da notificação
let contexto = UNMutableNotificationContent()
//Criando corpo da notificação
contexto.title = titulo
contexto.subtitle = subtitulo
contexto.body = mensagem
import UIKit
import UserNotifications
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
extension AppDelegate: UNUserNotificationCenterDelegate {
func enviarNotificacao(_ titulo:String, _ subtitulo:String, _ mensagem:String,
_ identificador:String, _ tempo:TimeInterval) {
//Essa instancia de classe é necessária para criar o corpo da notificação
let contexto = UNMutableNotificationContent()
//Criando corpo da notificação
contexto.title = titulo
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
//call
guard let confettiImageView = UIImageView.fromGif(frame: view.frame, resourceName: "cat") else { return }
import UIKit
//Importamos a framework
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?