নোটিফিকেশন আপনার অ্যাপের ইউজারদের গুরুত্বপূর্ণ তথ্য যোগাযোগ করে, আপনার অ্যাপ ইউজারের ডিভাইসে চলছে কিনা সেটা না করেই।
উদাহরণস্বরূপ, একটি স্পোর্টস অ্যাপ ইউজারকে জানাতে পারে তাদের প্রিয় টিম যখন গোল করে। নোটিফিকেশন আপনার অ্যাপকে তথ্য ডাউনলোড করতে এবং ইন্টারফেস আপডেট করতে বলতে পারে। নোটিফিকেশন এলার্ট দেখাতে পারে, সাউন্ড প্লে করতে পারে, বা অ্যাপ আইকনে ব্যাজ (badge) দেখাতে পারে।

নোটিফিকেশন স্ট্যাটাস সম্পর্কে আরো জানুন: https://developer.apple.com/documentation/usernotifications
Apple UserNotifications ফ্রেমওয়ার্ক ব্যবহার করার সুপারিশ করে, তাহলে শুরু করি। নোটিফিকেশন স্ট্যাটাস পাওয়ার খুব সিম্পল এবং সহজ সমাধান দেখব।
Step 1 − প্রথমে UserNotifications ফ্রেমওয়ার্ক ইম্পোর্ট করুন।
import UserNotifications
Step 2 − UNUserNotificationCenter.current() অবজেক্ট তৈরি করুন।
let currentNotification = UNUserNotificationCenter.current()
Step 3 − স্ট্যাটাস চেক করুন।
currentNotification.getNotificationSettings(completionHandler: { (settings) in
if settings.authorizationStatus == .notDetermined {
// Notification permission is yet to be been asked go for it!
} else if settings.authorizationStatus == .denied {
// Notification permission was denied previously, go to settings & privacy to re-enable the permission
} else if settings.authorizationStatus == .authorized {
// Notification permission already granted.
}
})
ফাইনাল কোড
import UserNotifications
let currentNotification = UNUserNotificationCenter.current()
currentNotification.getNotificationSettings(completionHandler: { (settings) in
if settings.authorizationStatus == .notDetermined {
// Notification permission is yet to be been asked go for it!
} else if settings.authorizationStatus == .denied {
// Notification permission was denied previously, go to settings & privacy to re-enable the permission
} else if settings.authorizationStatus == .authorized {
// Notification permission already granted.
}
})