@rubiriffic @ckbrown - Iāve just tried to see whatās working at the moment. Looks like that kind of parameter routing isnāt in yet, youāll need to stick to using String.parameter
and pulling out all of them and only using the ones you want for now. Iāve asked in Slack to see what the status/plan is for this kind of thing. (Though I would still argue if you are throwing away a dynamic parameter you have a design issue)
actually no I didnāt run that, I missed the part where you said this would get the beta branch of Vapor and I thought you were creating a local branch called ābetaā so I skipped it because I didnāt really care about git at the moment. Guess I should have paid closer attention! lol
Ha! No the --branch=beta
specifies which branch of the template to use
Iām getting no such module name Vapor in my application
My build is failing but Iām not getting why.
/Users/abhinavverma/Desktop/vapor/Hello_vapor/.build/checkouts/crypto.git-7980259129511365902/Sources/Crypto/Cipher/Cipher+Method.swift:1:8: error: could not build Objective-C module āCTLSā
import CTLS
I got an error of brew link cels. that command had failed when I was setting up my vapour toolbox.
@averma12 are you definitely on Vapor 3? What does your Package.swift
file look like? It should have .package(url: "https://github.com/vapor/vapor.git", from: "3.0.0-rc"),
in it. If it says .upToNextMajor("2.1.0")
then you are on Vapor 2. Iām pretty sure CTLS isnāt required for Vapor 3.
Your code :
let name = try req.parameter(String.self)
your code donāt work for me
Because function parameter is changed
Correct code
let name = try req.parameters.next(String.self)
@lashkari are you definitely on Vapor 3? Did you pass in the --branch=beta
flag when you created the project? let name = try req.parameters.next(String.self)
is for Vapor 2
vapor version
Vapor Toolbox: 3.1.4
how to change and update this ?
The easiest way will be to start from scratch. In terminal run:
cd ~/vapor
rm -rf HelloVapor
vapor new HelloVapor --branch=beta
iām using Swift 4.1 snapshot , and in terminal using this code
vapor new HelloVapor --branch=beta
but in Xcode i have one error
No such module āAppā
can you help me?
@lashkari make sure you do a build first - sometimes Xcode can get confused with SPM when it hasnāt built anything yet
The problem was solved
thanks a lot
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: āHello_vaporā,
products: [
.library(name: āAppā, targets: [āAppā]),
.executable(name: āRunā, targets: [āRunā])
],
dependencies: [
.package(url: āGitHub - vapor/vapor: š§ A server-side Swift HTTP web framework.ā, .upToNextMajor(from: ā2.1.0ā)),
.package(url: āGitHub - vapor-community/fluent-provider: A provider for including Fluent in Vapor applicationsā, .upToNextMajor(from: ā1.2.0ā)),
],
targets: [
.target(
name: āAppā,
dependencies: [āVaporā, āFluentProviderā],
exclude: [āConfigā, āPublicā, āResourcesā]
),
.target(name: āRunā, dependencies: [āAppā]),
.testTarget(name: āAppTestsā, dependencies: [āAppā, āTestingā])
]
)
Terminal:
eval ā$(curl -sL check.vapor.sh)ā:
Xcode 9 is compatible with Vapor 2.
Xcode 9 is compatible with Vapor 3.
Swift 4.0 is compatible with Vapor 2.
Swift 4.1 or later is required for Vapor 3.
Tried this solution:
Looks like I need to update to 4.1 in vapor?
Clicked build before making any changes, build successful, but as soon as I click on main.swift I get an error next to āimport Appā:
āModule compiled with Swift 4.1 cannot be imported in Swift 4.0.3: /Users/xxx/Library/Developer/Xcode/DerivedData/HelloVapor-gsmlftoylwgkmsgzoxnghlvcnzug/Build/Products/Debug/App.framework/Modules/App.swiftmodule/x86_64.swiftmoduleā
@doyle yes youāll need Swift 4.1 for Vapor 3. Howeverā¦ if you have installed Swift 4.1 as a toolchain in Xcode, your command line version will be Swift 4.0.
If it builds ok but you get errors popping up - I would ignore it, it is probably Xcode caching errors
They should go away, but if you clean the project (and delete Derived Data) you should be fine