Skip to content

Commit

Permalink
Update SPM demo for Swift beta2
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone committed Jul 19, 2019
1 parent 9e212e2 commit 581b87a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion swift/Manual/spm/printer/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.8.10"),
.package(url: "https://github.com/zeroc-ice/ice.git", from: "3.7.3-beta.0+spm")
.package(url: "https://github.com/zeroc-ice/ice.git", from: "3.7.3-beta.2+spm")
],
targets: [
.target(name: "Client", dependencies: ["Ice", "PromiseKit"]),
Expand Down
19 changes: 10 additions & 9 deletions swift/Manual/spm/printer/Sources/Client/Printer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) ZeroC, Inc. All rights reserved.
//
//
// Ice version 3.7b1
// Ice version 3.7b2
//
// <auto-generated>
//
Expand Down Expand Up @@ -163,18 +163,19 @@ public struct PrinterDisp: Ice.Disp {
self.servant = servant
}

public func dispatch(request: Ice.Request, current: Ice.Current) throws {
public func dispatch(request: Ice.Request, current: Ice.Current) throws -> PromiseKit.Promise<Ice.OutputStream>? {
request.startOver()
switch current.operation {
case "ice_id":
try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_id(incoming: request, current: current)
return try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_id(incoming: request, current: current)
case "ice_ids":
try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_ids(incoming: request, current: current)
return try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_ids(incoming: request, current: current)
case "ice_isA":
try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_isA(incoming: request, current: current)
return try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_isA(incoming: request, current: current)
case "ice_ping":
try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_ping(incoming: request, current: current)
return try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_ping(incoming: request, current: current)
case "printString":
try servant._iceD_printString(incoming: request, current: current)
return try servant._iceD_printString(incoming: request, current: current)
default:
throw Ice.OperationNotExistException(id: current.id, facet: current.facet, operation: current.operation)
}
Expand All @@ -195,14 +196,14 @@ public protocol Printer {
///
/// - printString:
public extension Printer {
func _iceD_printString(incoming inS: Ice.Incoming, current: Ice.Current) throws {
func _iceD_printString(incoming inS: Ice.Incoming, current: Ice.Current) throws -> PromiseKit.Promise<Ice.OutputStream>? {
let iceP_s: Swift.String = try inS.read { istr in
let iceP_s: Swift.String = try istr.read()
return iceP_s
}

try self.printString(s: iceP_s, current: current)

inS.writeEmptyParams()
return inS.setResult()
}
}
19 changes: 10 additions & 9 deletions swift/Manual/spm/printer/Sources/Server/Printer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) ZeroC, Inc. All rights reserved.
//
//
// Ice version 3.7b1
// Ice version 3.7b2
//
// <auto-generated>
//
Expand Down Expand Up @@ -163,18 +163,19 @@ public struct PrinterDisp: Ice.Disp {
self.servant = servant
}

public func dispatch(request: Ice.Request, current: Ice.Current) throws {
public func dispatch(request: Ice.Request, current: Ice.Current) throws -> PromiseKit.Promise<Ice.OutputStream>? {
request.startOver()
switch current.operation {
case "ice_id":
try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_id(incoming: request, current: current)
return try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_id(incoming: request, current: current)
case "ice_ids":
try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_ids(incoming: request, current: current)
return try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_ids(incoming: request, current: current)
case "ice_isA":
try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_isA(incoming: request, current: current)
return try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_isA(incoming: request, current: current)
case "ice_ping":
try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_ping(incoming: request, current: current)
return try (servant as? Object ?? PrinterDisp.defaultObject)._iceD_ice_ping(incoming: request, current: current)
case "printString":
try servant._iceD_printString(incoming: request, current: current)
return try servant._iceD_printString(incoming: request, current: current)
default:
throw Ice.OperationNotExistException(id: current.id, facet: current.facet, operation: current.operation)
}
Expand All @@ -195,14 +196,14 @@ public protocol Printer {
///
/// - printString:
public extension Printer {
func _iceD_printString(incoming inS: Ice.Incoming, current: Ice.Current) throws {
func _iceD_printString(incoming inS: Ice.Incoming, current: Ice.Current) throws -> PromiseKit.Promise<Ice.OutputStream>? {
let iceP_s: Swift.String = try inS.read { istr in
let iceP_s: Swift.String = try istr.read()
return iceP_s
}

try self.printString(s: iceP_s, current: current)

inS.writeEmptyParams()
return inS.setResult()
}
}

0 comments on commit 581b87a

Please sign in to comment.