We are only a few days away from WWDC 2017! This week the Swift repository saw its 10,000th pull request. Things have been more quiet than usual, but we did get a great update to the WWDC iOS app. 😅 I did not get a ticket, but I will be hanging out in San Jose for most of the week — if you are attending it would be great to meet in person! Aside from WWDC, there are a number of other events happening. For the Swift community, check out Realm’s WWDC Swift Panel and the SwiftCoders meet & greet at AltConf. See you next week!
Robotary is architected around a sea of subprocesses. For one, SourceKit, which provides code completions and drives syntax highlighting, runs in an XPC Service. Hardware communication over Bluetooth, HID, and USB transports all happens in isolated XPC Services, and the debug server runs in a separate process as well. Lego Mindstorms is a hardware and software structure which is produced by Lego for the development of programmable robots based on Lego building blocks.Each version of the system includes a computer Lego brick that controls the system, a set of modular sensors and motors, and Lego parts from the Technic line to create the mechanical systems.
Interested in sponsoring Swift Weekly Brief? Learn more here.
aspatterns with CoreFoundation types
Episode 13: WWDC Predictions
This week, we share our hopes and expectations for the Swift language at WWDC 2017!
Caleb Davenport highlighted a somewhat undesirable change coming in Swift 4. Due to proposal SE-0110 (but really SE-0029), N-ary tuples are no longer expanded to N arguments in a closure (the “tuple splat behavior”). This means closures will receive a single tuple parameter and you’ll have to expand them manually. Joe Groff noted that this was a source of bad type-checker performance and sympathized about rolling back this syntactic sugar.
In a recent episode of the SwiftCoders podcast, Garric Nahapetian interviews Robert Widmann (aka @CodaFi_), a Swift compiler intern and Swift open source contributor.
Apple have released a free, beginner-level, 900 page book “App Development with Swift” and related teaching materials. In total, it looks like there are 2 books and 5 teacher guides in the series. Hat tip @cocoawithlove.
Thanks to JP Simard for showing me a Swift IDE for macOS called Robotary, which you can use to program LEGO MINDSTORMS EV3 robots. It’s been around for some time and hasn’t been updated since last September, but it looks pretty cool. 😎 Also — lego robots. 😱
Dave Abrahams opened a pull request with his overhaul changes to
String.Index. See the mailing list section below for details on the proposal.
Amr Aboelela wrote a
build-toolchain script for Android, similar to the existing
build-toolchain script for Darwin. This should be useful for anyone experimenting with Swift on Android.
Ben Cohen added benchmarks for equating/comparing substrings.
run Command was accepted with revisions.
The proposal has been accepted with revision for Swift 4. There was unanimous support for the proposal in general, but there was discussion on three major points:
-- command syntax.
We decided we will not support the:
swift run -- arg1 arg2 arg3 syntax, for packages with only one executable, because we felt it was not sufficiently useful versus spelling the command name, and we didn’t want to unnecessarily have two ways to do the same thing. This behavior would be additive if it proved to be worth adding down the road.
We will support the no argument
swift run form in the proposal, since it is unambiguous.
2) Whether to build by default.
This behavior is consistent with our existing behavior for
swift test, and so we believe this is the correct behavior for this proposal.
3) The confusion over the
We agreed with the feedback that this was confusing, and so decided to:
--package-pathand change it to simply define the package to work on instead of as a side effect of changing directories. We chose –package-path over –package to leave room for
--package <NAME>syntax in the future, should we have an index. We will make this change and deprecate
--chdirin Swift 4, and remove it at a later date.
--in-dirargument, and instead leave it up to commands themselves to manage interaction with the working directory.
swift runto always execute the command in the directory from with
swift runwas run.
In combination, these choices allow
swift run foo ... to generally behave as it would if the package’s products had been built, installed, and run via the shell normally. We believe this allows
swift run ... to integrate with the shell as naturally as possible.
Thank you to everyone who participated!
There was no email on the lists, but SE-0177: Add
clamp(to:) to the stdlib was returned for revision. Given that this hasn’t been communicated to swift-evolution (a review never started in the first place), my guess is that this is simply out-of-scope for Swift 4. That, or everyone is too busy preparing for WWDC. 😅
Dave Abrahams pitched a proposal to overhaul
String.Index. You can find the draft here and the pull request here that implements the changes!
String shares an
Index type with its
CharacterView but not with its
UnicodeScalarView. This proposal redefines
String.CharacterView.Index as typealiases for
String.Index, and exposes a public
encodedOffset property and initializer that can be used to serialize and deserialize positions in a
The result is a great deal of API surface area for apparently little gain in ordinary code, that normally only interchanges indices among views when the positions match up exactly (i.e. when the conversion is going to succeed). Also, the resulting code is needlessly awkward.
And finally — we cannot be trusted with state.
Robotary makes it fun and easy to program consumer robots. Robotary is built around the Swift programming language, letting new programmers get up and running quickly. Meanwhile, advanced programmers can take advantage of powerful object-, functional-, and protocol-oriented paradigms.
In addition to full support for the Swift Standard Library, Robotary includes RobotKit, a robotics framework we built from the ground up for Swift. It provides access to all of your robot's hardware, including motors, sensors, buttons, and LEDs. Robotary supports the past two generations of LEGO MINDSTORMS robotics sets -- the NXT 2.0 and EV3. If your favorite robotics set isn't supported, let us know.