ricardorauber / strapiswift Goto Github PK
View Code? Open in Web Editor NEWA Swift toolkit to connect to your Strapi backend
License: MIT License
A Swift toolkit to connect to your Strapi backend
License: MIT License
Any idea on how to add offline persistence or offline syncing support to an app that uses Strapi? Something that Firestore etc. provide?
On my Strapi I have the default User (from "user-permissions"), and I have on it a field called "picture".
Using the upload I'm doing something like this:
contentType: "user",
id: 1,
field: "picture",
image: profilePicture,
compressionQuality: 90) { response in
guard let record = response.dictionaryValue() else {
return
}
print("Some data: \(record)")
}```
But I keep having a 500 error even if I let an unauthenticated user try to upload something.
What am I doing wrong here? Thanks
Having issues using this library to connect to my local Strapi instance
I noticed when I make requests with other frameworks that it is /api/tests
instead /tests
. Should the StrapiSwift library be adding a prefix of /api
? Or am I doing something else wrong here?
[2022-06-13 13:29:21.686] http: POST /tests (4 ms) 405
2022-06-13 13:30:30.612046-0400 APPNAME[9756:3200131] [connection] nw_socket_handle_socket_event [C5.1:2] Socket SO_ERROR [61: Connection refused]
{
"kind": "collectionType",
"collectionName": "tests",
"info": {
"singularName": "test",
"pluralName": "tests",
"displayName": "Test"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"name": {
"type": "string"
}
}
}
import Foundation
import Combine
import FirebaseAuth
import StrapiSwift
class StrapiService: StrapiAPI {
private let strapi = Strapi(scheme: .http, host: "localhost", port: 1337)
func createScorecard(courseName: String) {
let request = CreateRequest(
contentType: "test",
parameters: [
"name": courseName,
]
)
strapi.exec(request: request) { response in
if let error = response.error {
// There was a connection failure
print(error)
return
}
if let error = response.strapiError() {
// Oh no, something went wrong with your data :(
print(error)
return
}
guard let record = response.dictionaryValue(),
let id = record["id"] as? Int
else {
//print(response)
return
}
print("STRAPI: Created record with id: \(id)")
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.