Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block RameshAran

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:95129263f6fee82e2327c94af30464d8
let imageNameOne = "icon_image_1"
let image1 = UIImage(named: imageNameOne)!
//UIImage accepts any string
let image2 = UIImage(named: NSFileHandleNotificationFileHandleItem)!
View UIImage usage
let image1 = UIImage(named: "icon_image_1")!
let image2 = UIImage(named: "icon_image_2")!
let image3 = UIImage(named: "icon_image_3")!
View assetcatalog identifiers
import UIKit
enum AssetIdentifier: String {
case ImageIconOne = "icon_image_1"
case ImageIconTwo = "icon_image_2"
case ImageIconThree = "icon_image_3"
extension UIImage {
View Swift Singleton Example
import Foundation
class SessionManager {
public static let sharedInstance = SessionManager()
let dataManager: StoreDataManager
private init() {
self.dataManager = StoreDataManager()
View gist:38b350482b848ba88bc08c8de2998488
let content = UNMutableNotificationContent()
content.title = NSString.localizedUserNotificationString(forKey: "Hello!", arguments: nil)
content.body = NSString.localizedUserNotificationString(forKey: "Hello_message_body", arguments: nil)
content.sound = UNNotificationSound.default()
// Deliver the notification in five seconds.
let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 5, repeats: false)
let request = UNNotificationRequest.init(identifier: "notification_sample_2", content: content, trigger: trigger)
// Schedule the notification.
View gist:6bebf3fb61c73ac4f8b012253756b937
UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init];
content.title = [NSString localizedUserNotificationStringForKey:@"Hello!"
content.body = [NSString localizedUserNotificationStringForKey:@"Hello_message_body"
content.sound = [UNNotificationSound defaultSound];
UNTimeIntervalNotificationTrigger* trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:5
View gist:a17e209b16d79369976315b592ff9e97
let center = UNUserNotificationCenter.currentNotificationCenter()
center.requestAuthorizationWithOptions([.Alert, .Sound]) { (granted, error) in
// Enable or disable features based on authorization.
View gist:a3e669283c2faad0312bb3be9e733983
UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
[center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound)
completionHandler:^(BOOL granted, NSError * _Nullable error) {
// Enable or disable features based on authorization.
View gist:b4292b37f53a1539248b56f0f704e4f7
- (void)printQualityLevel
NSLog(@"current playback quality:- ");
switch (self.mYTPlayerView.playbackQuality) {
case kYTPlaybackQualitySmall:
case kYTPlaybackQualityMedium:
You can’t perform that action at this time.