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
var keyboardHeight: CGFloat = 0 |
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
override func viewDidLoad() { | |
super.viewDidLoad() | |
let tap = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard)) | |
tap.cancelsTouchesInView = false | |
view.addGestureRecognizer(tap) | |
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow(_:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil) | |
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHide(_:)), name: NSNotification.Name.UIKeyboardWillHide, object: 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
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) { | |
switch application.applicationState { | |
// uygulama ön planda aktif kullanılıyorken | |
case .active: | |
break | |
// uygulama arka planda çalışıyor ve etkinlikleri alabiliyor | |
case .background: |
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
let appDelegate = UIApplication.shared.delegate as? AppDelegate | |
if let actionType = appDelegate?.actionType { | |
setAction(actionType: actionType) | |
appDelegate?.actionType = nil | |
} else { | |
print("actionType: 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
var actionType: String? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
if let push = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? [String: Any] { | |
if let notificationDict = push["aps"] as? [String: Any] { | |
actionType = notificationDict["actionType"] as? String | |
} | |
} |
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
{ | |
"aps":{ | |
"alert":"Test", | |
"sound":"default", | |
"badge":1, | |
"actionType":"ana_sayfa" | |
} | |
} |
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 application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { | |
print("Notification registration is success.") | |
if #available(iOS 10.0, *) { | |
let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)}) | |
print(deviceTokenString) | |
} else { | |
let tokenParts = deviceToken.map { data -> String in | |
return String(format: "%02.2hhx", data) |
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 | |
enum ScreenType { | |
case iPhone4 | |
case iPhone5 | |
case iPhone6 | |
case iPhonePlus | |
case iPhoneX | |
case unknown | |
} |
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
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { | |
// MARK: Outlets | |
@IBOutlet weak var table: UITableView! | |
// MARK: Properties | |
var navigationView = UIView() | |
override func viewDidLoad() { | |
super.viewDidLoad() |