无法pip install Twisted [windows_platform]使用 Python 3.8.0 在 Windows 10 上安装 Twisted with 。错误:
ERROR: Command errored out with exit status 1:
command: 'c:\users\darkfox\appdata\local\programs\python\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\darkfox\\AppData\\Local\\Temp\\pip-install-m3igdq78\\Twisted\\setup.py'"'"'; __file__='"'"'C:\\Users\\darkfox\\AppData\\Local\\Temp\\pip-install-m3igdq78\\Twisted\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\darkfox\AppData\Local\Temp\pip-install-m3igdq78\Twisted\pip-egg-info'
cwd: C:\Users\darkfox\AppData\Local\Temp\pip-install-m3igdq78\Twisted\
Complete output (83 lines):
Traceback (most recent call last):
File "c:\users\darkfox\appdata\local\programs\python\python38\lib\urllib\request.py", line 1317, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "c:\users\darkfox\appdata\local\programs\python\python38\lib\http\client.py", line 1230, in request
self._send_request(method, url, body, headers, encode_chunked)
//delete fragment
File "c:\users\darkfox\appdata\local\programs\python\python38\lib\ssl.py", line 1309, …Run Code Online (Sandbox Code Playgroud) ScrollView 加载数据后不更新。只有在我切换到另一个屏幕并返回后,ScrollView 才能成功显示数据。 https://youtu.be/0q3R6LaKbnE
对于异步图像加载,请使用:https : //github.com/dmytro-anokhin/url-image
import Combine
import SwiftUI
class NewsAPI: ObservableObject {
@Published var articles: Articles = [Article]()
init() {
guard let url: URL = URL(string: "https://newsapi.org/v2/top-headlines?country=ru&apiKey=376a97643c6c4633afe57427b71e8ebd") else { return }
URLSession.shared.dataTask(with: url) { (data, response, error) in
do {
guard let json = data else { return }
let welcome = try JSONDecoder().decode(ModelNews.self, from: json)
DispatchQueue.main.async {
self.articles = welcome.articles!
}
}
catch {
print(error)
}
}
.resume()
}
}
Run Code Online (Sandbox Code Playgroud)
struct CardList: View {
@ObservedObject …Run Code Online (Sandbox Code Playgroud) 我创建了一个能够通过以下方法删除行的列表:.onDelete (perform:)。
List {
ForEach(itemList.dataLocation) { item in
NavigationLink(destination: ListDetails(name: item.nameDB)) {
ListItem(name: item.nameDB)
}
}
.onDelete(perform: delete)
.onMove(perform: move)
}
func delete(at offsets: IndexSet) {
itemList.dataLocation.remove(atOffsets: offsets)
session.deleteData(id: //id row) //this problem
}
Run Code Online (Sandbox Code Playgroud)
如何将已删除字符串的值传递给函数?建议仍然从该行获取数据。提前致谢!
我遇到了这样的问题,有没有人有任何想法如何解决它?Xcode 11.2,SwiftUI
.onAppear(perform: self.sessionChat.loadMsgInChatRoom(chatRoom: chatRoom)) //then an error
func loadMsgInChatRoom(chatRoom: String) {
let db = Firestore.firestore()
db.collection("chatRoom").document(chatRoom).collection("msg")
.addSnapshotListener { (querySnapshot, err) in
if err != nil {
print((err?.localizedDescription)!)
return
}
for i in querySnapshot!.documentChanges {
if i.type == .added {
let user = i.document.get("user") as! String
let msg = i.document.get("msg") as! String
let idUser = i.document.get("idUser") as! String
let dateMsg = i.document.get("dateMsg") as! String
let id = i.document.documentID
self.msgs.append(dataMessges(id: id, user: user, msg: msg, idUser: idUser, dateMsg: dateMsg))
}
} …Run Code Online (Sandbox Code Playgroud)