Created
January 3, 2015 04:26
-
-
Save toddkramer/0a1a0e65736e042a71ad to your computer and use it in GitHub Desktop.
ExtensionDataSharing02-TodayViewController.swift
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 | |
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