This file contains hidden or 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
| <key>NSAppTransportSecurity</key> | |
| <dict> | |
| <key>NSAllowsArbitraryLoads</key> | |
| <true/> | |
| </dict> |
This file contains hidden or 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
| <key>UIViewControllerBasedStatusBarAppearance</key> | |
| <false/> | |
| //In AppDelegate.swift | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
| // Override point for customization after application launch. | |
| UIApplication.shared.statusBarStyle = .lightContent //White colored status. | |
| return true | |
| } |
This file contains hidden or 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
| //Declare | |
| @IBOutlet weak var tableView:UITableView! | |
| var refreshControl = UIRefreshControl() | |
| //Adding in viewDidLoad() | |
| refreshControl.addTarget(self, action: #selector(ViewController.refreshEvents), for: .valueChanged) | |
| tableView.addSubView(refreshControl) | |
| //refreshEvents function | |
| func refreshEvents(){ |
This file contains hidden or 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
| //Source: https://github.com/ariok/TB_TwitterUI | |
| @IBOutlet weak var headerView: UIView! | |
| @IBOutlet weak var scrollView: UIScrollView! | |
| override viewDidLoad(){ | |
| scrollView.delegate = self | |
| /* | |
| Add below code for testing purposes. | |
| scrollView.contentSize = CGSize(width: self.view.frame.size.width, height: 1024) |
This file contains hidden or 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
| // | |
| // MessageDetailsViewController.swift | |
| // Messenger | |
| // | |
| // Created by Anuraag Jain on 05/12/16. | |
| // Copyright © 2016 Anuraag. All rights reserved. | |
| // Part 1 : https://gist.github.com/anuraagdjain/e874a8409225356233d56df435b96335 | |
| import UIKit | |
| import MobileCoreServices |
This file contains hidden or 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
| // | |
| // ViewController.swift | |
| // Messenger | |
| // | |
| // Created by Anuraag Jain on 05/12/16. | |
| // Copyright © 2016 Anuraag. All rights reserved. | |
| // Part 2 : https://gist.github.com/anuraagdjain/b049fe19b15c02901b50bd6a82d2d147/edit | |
| import UIKit |
This file contains hidden or 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 CoreData | |
| //MARK: - Core Data Stack | |
| let dbName = "My_Data_Model_Name" | |
| func applicationWillTerminate(_ application: UIApplication) { | |
| // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. | |
| self.saveContext() | |
| } | |
| private lazy var applicationDocumentsDirectory: URL = { | |
| // The directory the application uses to store the Core Data store file. This code uses a directory named in the application's documents Application Support directory. |
This file contains hidden or 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 layoutSubviews() { | |
| super.layoutSubviews() | |
| var subviews: [Any] = self.subviews | |
| let subview = subviews[0] as! UIView | |
| if subview.classForCoder.debugDescription() == "UITableViewCellDeleteConfirmationView" { | |
| subview.frame.size.height = 50 | |
| subview.frame.origin.y = 10 | |
| subview.clipsToBounds = true | |
| subview.layer.masksToBounds = true | |
| } |
This file contains hidden or 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
| const vowelRegex = new RegExp('^[aeiou]', 'g'); | |
| function pigLatin(str){ | |
| if (vowelRegex.test(str)) { | |
| return `${str}way`; | |
| } else { | |
| const first = str.slice(0, 1); | |
| const rem = str.slice(1, str.length); | |
| return `${rem}${first}ay`; | |
| } | |
| } |
This file contains hidden or 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
| "use strict"; | |
| const fizzBuzz = () => { | |
| for (let i = 1; i <= 100; i++) { | |
| const mod5 = i % 5, | |
| mod3 = i % 3; | |
| if (mod3 === 0 && mod5 === 0) console.log("FizzBuzz"); | |
| else if (mod3 === 0) console.log("Fizz"); | |
| else if (mod5 === 0) console.log("Buzz"); | |
| else console.log(i); |
OlderNewer