Skip to content

Commit

Permalink
Stable for first beta release
Browse files Browse the repository at this point in the history
  • Loading branch information
manavgabhawala committed Aug 12, 2015
1 parent eccd86b commit 24a4eb1
Show file tree
Hide file tree
Showing 19 changed files with 871 additions and 77 deletions.
422 changes: 418 additions & 4 deletions CocoaMultipeer.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -52,11 +52,11 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
Expand All @@ -74,10 +74,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
Expand All @@ -55,10 +55,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -52,11 +52,11 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
Expand All @@ -74,10 +74,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82B471771B75F27600E2783C"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:CocoaMultipeer.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82B471831B75F27600E2783C"
BuildableName = "Watch Extension.appex"
BlueprintName = "Watch Extension"
ReferencedContainer = "container:CocoaMultipeer.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "823F3EBC1B53F13500A7B7F1"
BuildableName = "iOS.app"
BlueprintName = "iOS"
ReferencedContainer = "container:CocoaMultipeer.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82B471771B75F27600E2783C"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:CocoaMultipeer.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.carousel"
RemotePath = "/iOS">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82B471771B75F27600E2783C"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:CocoaMultipeer.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82B471771B75F27600E2783C"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:CocoaMultipeer.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.carousel"
RemotePath = "/iOS">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82B471771B75F27600E2783C"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:CocoaMultipeer.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82B471771B75F27600E2783C"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:CocoaMultipeer.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>Watch.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>5</integer>
</dict>
<key>iOS.xcscheme</key>
<dict>
<key>orderHint</key>
Expand All @@ -47,6 +52,11 @@
<key>primary</key>
<true/>
</dict>
<key>82B471771B75F27600E2783C</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>82CB0ED21B3B42C70092AFEB</key>
<dict>
<key>primary</key>
Expand Down
4 changes: 1 addition & 3 deletions Common/MGNearbyServiceBrowserDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

import Foundation


/** The MGNearbyServiceBrowserDelegate protocol defines methods that a MGNearbyServiceBrowser object’s delegate can implement to handle browser-related and invitation events. Since all activity is asynchronous in nature, you cannot make any assumptions of the thread on which the delegate's methods will be called.
*/
/// The MGNearbyServiceBrowserDelegate protocol defines methods that a MGNearbyServiceBrowser object’s delegate can implement to handle browser-related and invitation events. Since all activity is asynchronous in nature, you cannot make any assumptions of the thread on which the delegate's methods will be called.
@objc public protocol MGNearbyServiceBrowserDelegate
{
/// The browser object that failed to start browsing.
Expand Down
33 changes: 16 additions & 17 deletions Common/MGSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,21 @@ delegate method should explicitly dispatch or schedule that work. Only small tas
public weak var delegate: MGSessionDelegate?

/// An array of all peers that are currently connected to this session. (read-only)
public var connectedPeers: [MGPeerID] { return peers.filter { $0.state == .Connected }.map { $0.peer } }
public var connectedPeers: [MGPeerID]
{
var connectedPeers = [MGPeerID]()
connectedPeers.reserveCapacity(peers.count)
for peer in peers
{
guard peer.state == .Connected
else
{
continue
}
connectedPeers.append(peer.peer)
}
return connectedPeers
}

/// An array of a tuple of all the values needed for a proper connection to a peer.
internal var peers = [(peer: MGPeerID, state: MGSessionState, input: NSInputStream, output: NSOutputStream, writeLock: NSCondition)]()
Expand All @@ -91,6 +105,7 @@ delegate method should explicitly dispatch or schedule that work. Only small tas
/// - Parameter data: An object containing the message to send.
/// - Parameter peerIDs: An array of peer ID objects representing the peers that should receive the message.
/// - Throws: MultipeerError.NotConnected error if you are attempting to send data to a peer that is not connected. Try checking the status of the peer again, reestablishing the connection by allowing the user to reinvite the lost device.
/// - SeeAlso: `session:didRecieveData:fromPeer`
public func sendData(data: NSData, toPeers peerIDs: [MGPeerID]) throws
{
guard data.length > 0
Expand Down Expand Up @@ -236,22 +251,6 @@ delegate method should explicitly dispatch or schedule that work. Only small tas
lostPeer(index)
}

/// Use this function to introspect a peer and get its state.
///
/// - Parameter peer: The peer whose state is wanted.
/// - Throws: A `MultipeerError.PeerNotFound` error if the peer doesn't exist in the list of peers returned by `connectedPeers`.
/// - Returns: The state of the peer. See `MGSessionState`
/*
internal func stateForPeer(peer: MGPeerID) throws -> MGSessionState
{
guard let index = peers.indexOf({ $0.peer == peer })
else
{
throw MultipeerError.PeerNotFound
}
return peers[index].state
}*/

/// Disconnects the remote peer from the session. Usually, you would call this on the server and not the client. See `disconnect` for client side disconnects.
///
/// - Parameter peer: The peer to disconnect from the server.
Expand Down
6 changes: 3 additions & 3 deletions Common/MultipeerError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import Foundation
public enum MultipeerError : Int, ErrorType, Hashable, CustomStringConvertible
{
/// The peer sent wasn't recognized or found.
case PeerNotFound
case PeerNotFound = 0

/// The attempt to connect to the peer failed. This means that the peer was lost between the `invitePeer` call and actually establishing the connection.
case ConnectionAttemptFailed
case ConnectionAttemptFailed = 1

/// Attempting to do something with a peer that isn't connected to the session.
case NotConnected
case NotConnected = 2

public var description: String
{
Expand Down
32 changes: 0 additions & 32 deletions MultipeerCocoaWatchOS/MGBrowserViewController.swift

This file was deleted.

0 comments on commit 24a4eb1

Please sign in to comment.