From 1a36732f90002c754700093c540668f49fdb2933 Mon Sep 17 00:00:00 2001 From: "Martin J. Lasek" Date: Thu, 15 Feb 2018 19:24:10 +0100 Subject: [PATCH] Fixing Error: Ambiguous use of 'popLast()' PostgreSQL would not compile due to: `Ambiguous use of 'popLast()'` Here's a working (workaround?) `x.popFirst()!` returns the first element of the collection if not empty. Otherwise nil. Plus removes first element from x. `x.first!` returns the first element of the collection if not empty. Otherwise nil. Does not removes first element from x. That's why I added: `x.removeFirst()` afterwards. --- Sources/PostgreSQL/Data/PostgreSQLData+Point.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/PostgreSQL/Data/PostgreSQLData+Point.swift b/Sources/PostgreSQL/Data/PostgreSQLData+Point.swift index 25c21f29..15c119bc 100644 --- a/Sources/PostgreSQL/Data/PostgreSQLData+Point.swift +++ b/Sources/PostgreSQL/Data/PostgreSQLData+Point.swift @@ -49,8 +49,10 @@ extension PostgreSQLPoint: PostgreSQLDataCustomConvertible { let parts = string.split(separator: ",") var x = parts[0] var y = parts[1] - assert(x.popFirst()! == "(") - assert(y.popLast()! == ")") + assert(x.first! == "(") + assert(y.last! == ")") + x.removeFirst() + y.removeLast() return .init(x: Double(x)!, y: Double(y)!) case .binary: let x = value[0..<8]