Skip to content

Instantly share code, notes, and snippets.

1. Install all iOS simulators after Xcode update
2. Open Xcode preferences (Cmd+,) and navigate to "Locations" tab where will be shown path to "DerivedData" folder
3. Click on small circle with arrow on the right side of shown "DerivedData" path to open it in Finder
4. Quit Xcode
5. Remove "DerivedData" folder
6. Clean up CocoaPods (if integrated with it) caches by entering this in Terminal:
rm -rf ~/Library/Caches/CocoaPods
7. From project root (where Podfile is located) run this in Terminal:
@parfeon
parfeon / pubnub-swift-presence-example5.swift
Created August 18, 2015 10:10
Presence swift example
self.client?.subscribeToChannels(["chat"], withPresence: false,
clientState: ["chat": ["Key": "Value"]])
@parfeon
parfeon / pubnub-swift-presence-example4.swift
Created August 18, 2015 10:01
Presence swift example
self.client?.setState(["Key": "Value"], forUUID: self.client?.uuid(), onChannel: "chat",
withCompletion: { (status) -> Void in
if !status.error {
// Client state successfully modified on specified channel.
}
else {
// Handle client state modification error. Check 'category' property
@parfeon
parfeon / pubnub-swift-presence-example3.swift
Created August 18, 2015 09:59
Presence swift example
// Instance properties
var client: PubNub?
override init() {
let configuration = PNConfiguration(publishKey: "demo-36", subscribeKey: "demo-36")
configuration.uuid = "Stephen"
client = PubNub.clientWithConfiguration(configuration)
super.init()
@parfeon
parfeon / pubnub-swift-client-initialization-event-listening-example.swift
Created August 18, 2015 07:07
[Swift] PubNub initialization with event listening example
// Instance property
var client: PubNub?
// For demo purposes init function used to ensure what client will be instantiated before
// it will be used.
override init() {
// Instantiate configuration instance.
let configuration = PNConfiguration(publishKey: "demo-36", subscribeKey: "demo-36")
// Instantiate PubNub client.
@parfeon
parfeon / pubnub-swift-client-initialization-default-example.swift
Created August 18, 2015 07:03
[Swift] PubNub default initialization example
// Instance property
var client: PubNub?
// For demo purposes init function used to ensure what client will be instantiated before
// it will be used.
override init() {
// Instantiate configuration instance.
let configuration = PNConfiguration(publishKey: "demo-36", subscribeKey: "demo-36")
// Instantiate PubNub client.
// Instance properties
var client: PubNub?
// Configure PubNub client instance
let configuration = PNConfiguration(publishKey: "demo-36", subscribeKey: "demo-36")
configuration.TLSEnabled = true
self.client = PubNub.clientWithConfiguration(configuration)
// Instance properties
var client: PubNub?
// Configure PubNub client instance
let configuration = PNConfiguration(publishKey: "demo-36", subscribeKey: "demo-36")
self.client = PubNub.clientWithConfiguration(configuration)
self.client?.addListener(self)
self.client?.subscribeToChannels(["my_secret_channel"], withPresence: false)
// Handle new message from one of channels on which client has been subscribed.
// Instance properties
var client: PubNub?
// Configure PubNub client instance
let configuration = PNConfiguration(publishKey: "demo-36", subscribeKey: "demo-36")
configuration.cipherKey = "my_cipherkey"
self.client = PubNub.clientWithConfiguration(configuration)
let channelGroup = "family"
self.client?.removeChannelsFromGroup(channelGroup, withCompletion: { (status) -> Void in
if !status.error {
// Handle successful channel group removal.
}
else {
// Handle channel group removal error. Check 'category' property