Skip to content

Commit e6b5505

Browse files
authored
Merge pull request #24 from devinroth/develop
Merge develop branch v1.2.0
2 parents 89d94c5 + 9164a45 commit e6b5505

File tree

21 files changed

+360
-53
lines changed

21 files changed

+360
-53
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SwiftOSC Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [1.2.0] - 2018-08-18
11+
### Added
12+
- Changelog
13+
- Compile framework during build for example apps.
14+
- Add shared schemes for Carthage compatibility [#22](https://github.com/devinroth/SwiftOSC/pull/22)
15+
- Add init with array argument to OSCMessage.
16+
17+
### Chaged
18+
- Fix string decoding. String arg comparisons now work as expected.

Examples/iOS/OSCTest/OSCTest.xcodeproj/project.pbxproj

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
031ABE751FB64DC7005184D4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 031ABE731FB64DC7005184D4 /* Main.storyboard */; };
1313
031ABE771FB64DC7005184D4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 031ABE761FB64DC7005184D4 /* Assets.xcassets */; };
1414
031ABE7A1FB64DC7005184D4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 031ABE781FB64DC7005184D4 /* LaunchScreen.storyboard */; };
15+
0323C58C212861B200E10268 /* SwiftOSC.framework in Sources */ = {isa = PBXBuildFile; fileRef = 03F4BBF01FB6E2B900193238 /* SwiftOSC.framework */; };
1516
03F4BBF11FB6E2C100193238 /* SwiftOSC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03F4BBF01FB6E2B900193238 /* SwiftOSC.framework */; };
1617
03F4BBF21FB6E2C100193238 /* SwiftOSC.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 03F4BBF01FB6E2B900193238 /* SwiftOSC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1718
/* End PBXBuildFile section */
@@ -164,6 +165,7 @@
164165
isa = PBXSourcesBuildPhase;
165166
buildActionMask = 2147483647;
166167
files = (
168+
0323C58C212861B200E10268 /* SwiftOSC.framework in Sources */,
167169
031ABE721FB64DC7005184D4 /* ViewController.swift in Sources */,
168170
031ABE701FB64DC7005184D4 /* AppDelegate.swift in Sources */,
169171
);
@@ -307,7 +309,7 @@
307309
DEVELOPMENT_TEAM = 638F7EDPVY;
308310
INFOPLIST_FILE = OSCTest/Info.plist;
309311
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
310-
PRODUCT_BUNDLE_IDENTIFIER = com.devinrothmusic.OSCTest;
312+
PRODUCT_BUNDLE_IDENTIFIER = com.swiftosc.OSCTest;
311313
PRODUCT_NAME = "$(TARGET_NAME)";
312314
SWIFT_VERSION = 4.0;
313315
TARGETED_DEVICE_FAMILY = "1,2";
@@ -323,7 +325,7 @@
323325
DEVELOPMENT_TEAM = 638F7EDPVY;
324326
INFOPLIST_FILE = OSCTest/Info.plist;
325327
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
326-
PRODUCT_BUNDLE_IDENTIFIER = com.devinrothmusic.OSCTest;
328+
PRODUCT_BUNDLE_IDENTIFIER = com.swiftosc.OSCTest;
327329
PRODUCT_NAME = "$(TARGET_NAME)";
328330
SWIFT_VERSION = 4.0;
329331
TARGETED_DEVICE_FAMILY = "1,2";

Examples/iOS/OSCTest/OSCTest/AppDelegate.swift

-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@
88

99
import UIKit
1010

11-
//import framework
12-
import SwiftOSC
13-
14-
// Setup Client. Change address from localhost if needed.
15-
var client = OSCClient(address: "localhost", port: 8080)
16-
17-
18-
1911
@UIApplicationMain
2012
class AppDelegate: UIResponder, UIApplicationDelegate {
2113

Examples/iOS/OSCTest/OSCTest/Base.lproj/Main.storyboard

+88-24
Large diffs are not rendered by default.

Examples/iOS/OSCTest/OSCTest/ViewController.swift

+39-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,17 @@ import UIKit
1111
//import framework
1212
import SwiftOSC
1313

14-
let address = OSCAddressPattern("/test/")
14+
// Setup Client. Change address from localhost if needed.
15+
var client = OSCClient(address: "localhost", port: 8080)
16+
17+
var address = OSCAddressPattern("/")
1518

1619
class ViewController: UIViewController {
20+
21+
//Variables
22+
var ipAddress = "localhost"
23+
var port = 8080
24+
var text = ""
1725

1826
override func viewDidLoad() {
1927
super.viewDidLoad()
@@ -26,6 +34,32 @@ class ViewController: UIViewController {
2634
}
2735

2836
//Connect UI and send OSC message
37+
@IBAction func ipAddressTextField(_ sender: UITextField) {
38+
39+
if let text = sender.text {
40+
ipAddress = text
41+
client = OSCClient(address: ipAddress, port: port)
42+
}
43+
}
44+
45+
@IBAction func portTextField(_ sender: UITextField) {
46+
47+
if let text = sender.text {
48+
if let number = Int(text) {
49+
print(number)
50+
port = number
51+
client = OSCClient(address: ipAddress, port: port)
52+
}
53+
}
54+
}
55+
56+
@IBAction func addressPatternTextField(_ sender: UITextField) {
57+
58+
if let text = sender.text {
59+
address = OSCAddressPattern(text)
60+
}
61+
}
62+
2963
@IBAction func stepper(_ sender: UIStepper) {
3064
let message = OSCMessage(address, Int(sender.value))
3165
client.send(message)
@@ -46,15 +80,17 @@ class ViewController: UIViewController {
4680
client.send(message)
4781
}
4882

49-
var text = ""
5083
@IBAction func text(_ sender: UITextField) {
84+
5185
text = sender.text!
5286
}
5387

54-
5588
@IBAction func sendText(_ sender: UIButton) {
5689
let message = OSCMessage(address, text)
5790
client.send(message)
5891
}
92+
93+
94+
5995
}
6096

Examples/macOS/OSCMonitor/OSCMonitor.xcodeproj/project.pbxproj

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
0323C58B2128619600E10268 /* SwiftOSC.framework in Sources */ = {isa = PBXBuildFile; fileRef = 035F847F1FB6F39500C8C333 /* SwiftOSC.framework */; };
1011
033827B61D3999590065A3A7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033827B51D3999590065A3A7 /* AppDelegate.swift */; };
1112
033827B81D3999590065A3A7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033827B71D3999590065A3A7 /* ViewController.swift */; };
1213
033827BA1D3999590065A3A7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 033827B91D3999590065A3A7 /* Assets.xcassets */; };
@@ -166,6 +167,7 @@
166167
isa = PBXSourcesBuildPhase;
167168
buildActionMask = 2147483647;
168169
files = (
170+
0323C58B2128619600E10268 /* SwiftOSC.framework in Sources */,
169171
03D25C2D1D3A2D2E00BE9674 /* TableData.swift in Sources */,
170172
033827B81D3999590065A3A7 /* ViewController.swift in Sources */,
171173
033827B61D3999590065A3A7 /* AppDelegate.swift in Sources */,
@@ -297,7 +299,7 @@
297299
INFOPLIST_FILE = OSCMonitor/Info.plist;
298300
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
299301
MACOSX_DEPLOYMENT_TARGET = 10.11;
300-
PRODUCT_BUNDLE_IDENTIFIER = com.devinrothmusic.OSCMonitor;
302+
PRODUCT_BUNDLE_IDENTIFIER = com.swiftosc.OSCMonitor;
301303
PRODUCT_NAME = "$(TARGET_NAME)";
302304
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
303305
SWIFT_VERSION = 4.0;
@@ -313,7 +315,7 @@
313315
INFOPLIST_FILE = OSCMonitor/Info.plist;
314316
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
315317
MACOSX_DEPLOYMENT_TARGET = 10.11;
316-
PRODUCT_BUNDLE_IDENTIFIER = com.devinrothmusic.OSCMonitor;
318+
PRODUCT_BUNDLE_IDENTIFIER = com.swiftosc.OSCMonitor;
317319
PRODUCT_NAME = "$(TARGET_NAME)";
318320
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
319321
SWIFT_VERSION = 4.0;

Examples/macOS/OSCMonitor/OSCMonitor/AppDelegate.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Cocoa
1010
import SwiftOSC
1111

1212
//create OSC server
13-
var server = OSCServer(address: "", port: 9000)
13+
var server = OSCServer(address: "", port: 8080)
1414

1515
@NSApplicationMain
1616
class AppDelegate: NSObject, NSApplicationDelegate {

Examples/macOS/OSCMonitor/OSCMonitor/Base.lproj/Main.storyboard

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11163.2" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11163.2"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13529"/>
6+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
67
<capability name="stacking Non-gravity area distributions on NSStackView" minToolsVersion="7.0" minSystemVersion="10.11"/>
78
</dependencies>
89
<scenes>
@@ -669,6 +670,9 @@
669670
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
670671
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
671672
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
673+
<connections>
674+
<outlet property="delegate" destination="B8D-0N-5wS" id="Q0c-Yl-9SO"/>
675+
</connections>
672676
</window>
673677
<connections>
674678
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
@@ -693,7 +697,7 @@
693697
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
694698
<subviews>
695699
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" headerView="NrJ-mh-UkB" id="R0O-lp-46M">
696-
<rect key="frame" x="0.0" y="0.0" width="440" height="19"/>
700+
<rect key="frame" x="0.0" y="0.0" width="440" height="237"/>
697701
<autoresizingMask key="autoresizingMask"/>
698702
<size key="intercellSpacing" width="3" height="2"/>
699703
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>

Examples/macOS/OSCMonitor/OSCMonitor/ViewController.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class ViewController: NSViewController, NSTableViewDataSource, OSCServerDelegate
4646

4747
//add osc data from notification
4848
func didReceive(_ message: OSCMessage) {
49-
if message.address.matches(path: self.addressValue) {
49+
print(message)
50+
if message.address.matches(self.addressValue) {
5051
let tableData = TableData(Date(), message)
5152
self.tableData.append(tableData)
5253
tableView.reloadData()

Framework/SwiftOSC/Communication/OSCServer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public class OSCServer {
133133
messageData = messageData.subdata(in: Range(4..<messageData.count))
134134
case "s"://string
135135
let stringEnd = messageData.index(of: 0x00)!
136-
message.add(String(messageData.subdata(in: Range(0...stringEnd))))
136+
message.add(String(messageData.subdata(in: Range(0..<stringEnd))))
137137
messageData = messageData.subdata(in: Range((stringEnd/4+1)*4..<messageData.count))
138138
case "b": //blob
139139
var length = Int(messageData.subdata(in: Range(0...3)).toInt32())

Framework/SwiftOSC/Elements/OSCMessage.swift

+11-1
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,22 @@ public class OSCMessage: OSCElement, CustomStringConvertible {
8080
self.address = address
8181
self.arguments = arguments
8282
}
83+
84+
public init(_ address: OSCAddressPattern,_ arguments:[OSCType?]){
85+
self.address = address
86+
self.arguments = arguments
87+
}
88+
89+
//MARK: Methods
8390
public func add(){
8491
self.arguments.append(nil)
8592
}
8693

87-
//MARK: Methods
8894
public func add(_ arguments: OSCType?...){
8995
self.arguments += arguments
9096
}
97+
98+
public func add(_ arguments: [OSCType?]){
99+
self.arguments += arguments
100+
}
91101
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0930"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "036486751F820BBD00F3D6CE"
18+
BuildableName = "SwiftOSC.framework"
19+
BlueprintName = "SwiftOSC"
20+
ReferencedContainer = "container:iOS.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
<AdditionalOptions>
33+
</AdditionalOptions>
34+
</TestAction>
35+
<LaunchAction
36+
buildConfiguration = "Debug"
37+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
38+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
39+
launchStyle = "0"
40+
useCustomWorkingDirectory = "NO"
41+
ignoresPersistentStateOnLaunch = "NO"
42+
debugDocumentVersioning = "YES"
43+
debugServiceExtension = "internal"
44+
allowLocationSimulation = "YES">
45+
<MacroExpansion>
46+
<BuildableReference
47+
BuildableIdentifier = "primary"
48+
BlueprintIdentifier = "036486751F820BBD00F3D6CE"
49+
BuildableName = "SwiftOSC.framework"
50+
BlueprintName = "SwiftOSC"
51+
ReferencedContainer = "container:iOS.xcodeproj">
52+
</BuildableReference>
53+
</MacroExpansion>
54+
<AdditionalOptions>
55+
</AdditionalOptions>
56+
</LaunchAction>
57+
<ProfileAction
58+
buildConfiguration = "Release"
59+
shouldUseLaunchSchemeArgsEnv = "YES"
60+
savedToolIdentifier = ""
61+
useCustomWorkingDirectory = "NO"
62+
debugDocumentVersioning = "YES">
63+
<MacroExpansion>
64+
<BuildableReference
65+
BuildableIdentifier = "primary"
66+
BlueprintIdentifier = "036486751F820BBD00F3D6CE"
67+
BuildableName = "SwiftOSC.framework"
68+
BlueprintName = "SwiftOSC"
69+
ReferencedContainer = "container:iOS.xcodeproj">
70+
</BuildableReference>
71+
</MacroExpansion>
72+
</ProfileAction>
73+
<AnalyzeAction
74+
buildConfiguration = "Debug">
75+
</AnalyzeAction>
76+
<ArchiveAction
77+
buildConfiguration = "Release"
78+
revealArchiveInOrganizer = "YES">
79+
</ArchiveAction>
80+
</Scheme>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

0 commit comments

Comments
 (0)