Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save toddkramer/0a1a0e65736e042a71ad to your computer and use it in GitHub Desktop.
Save toddkramer/0a1a0e65736e042a71ad to your computer and use it in GitHub Desktop.
ExtensionDataSharing02-TodayViewController.swift
import UIKit
import NotificationCenter
class TodayViewController: UIViewController, NCWidgetProviding {
override func viewDidLoad() {
super.viewDidLoad()
self.preferredContentSize = CGSizeMake(320, 180);
println("Title: \(titleFromSharedDefaults())")
}
func titleFromSharedDefaults() -> String {
let sharedDefaults = NSUserDefaults(suiteName: "group.example.DataSharing")!
if let titleText = sharedDefaults.stringForKey("ExtensionTitleKey") {
return titleText
}
return ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment