几个月前我用 firebase 创建了一个云函数项目,并使用了 linting。
我最近使用 linting 创建了一个新的云函数项目,现在 linter 抱怨我从未设置过的随机规则。我不记得它在几个月前执行了几乎大量的样式规则。
像:
This line has a length of 95. Maximum allowed is 80
Missing JSDoc comment
Missing Trailing comma
expected indentation of 2 spaces but found 4
Strings must use singlequote
Run Code Online (Sandbox Code Playgroud)
它也不让我使用 async/await。
我发现我可以在我的 .eslintrc.js 文件中单独设置这些规则,但这很烦人,我不想这样做。默认情况下,为什么不禁用这些规则?我只想要确保我的代码在运行时不会失败的基本规则,而不是像单/双引号和最大行长度这样的随机样式首选项。
有什么方法可以将基本的 linting 功能与 firebase 功能一起使用吗?
我正在尝试将Snapkit与 iOS 应用程序集成,但我想使用 SwiftUI 而不是 UIKit。我已经使用 Snapkit 完成了所需的设置,现在我正在尝试让 Snapchat 登录按钮显示在我的应用程序中。我知道 Snapkit SDK 是为 UIKit 而不是 SwiftUI 制作的,但 SwiftUI 有一种方法可以使用 UIViewRepresentable 协议将 UIView 包装到 SwiftUI 中。我已经尝试实现此功能,但登录按钮仍然不显示。
\n\n这是我的代码:
\n\nimport SwiftUI\nimport UIKit\nimport SCSDKLoginKit\n\nstruct ContentView: View {\n var body: some View {\n SnapchatLoginButtonView()\n }\n}\n\nstruct ContentView_Previews: PreviewProvider {\n static var previews: some View {\n ContentView()\n }\n}\n\n\nstruct SnapchatLoginButtonView: UIViewRepresentable {\n\n func makeCoordinator() -> Coordinator {\n Coordinator()\n }\n\n func makeUIView(context: Context) -> SCSDKLoginButton {\n let s = SCSDKLoginButton()\n s.delegate = context.coordinator\n\n …Run Code Online (Sandbox Code Playgroud) 我使用 ViewControllerRepresentable 来呈现 MFMessageComposeViewController,以便用户可以从我的应用程序发送文本。
然而,每次呈现视图时,它都非常有问题 - 元素随机消失,滚动关闭,并且屏幕闪烁。在 iOS 14.2 和 14.3 上测试。
这是代码:
import SwiftUI
import MessageUI
struct MessageView: UIViewControllerRepresentable {
var recipient: String
class Coordinator: NSObject, MFMessageComposeViewControllerDelegate {
var completion: () -> Void
init(completion: @escaping ()->Void) {
self.completion = completion
}
// delegate method
func messageComposeViewController(_ controller: MFMessageComposeViewController,
didFinishWith result: MessageComposeResult) {
controller.dismiss(animated: true, completion: nil)
completion()
}
}
func makeCoordinator() -> Coordinator {
return Coordinator() {} // not using completion handler
}
func makeUIViewController(context: Context) -> MFMessageComposeViewController { …Run Code Online (Sandbox Code Playgroud) mfmessagecomposeviewcontroller mfmailcomposeviewcontroller swiftui uiviewrepresentable uiviewcontrollerrepresentable
swift ×2
swiftui ×2
eslint ×1
firebase ×1
ios ×1
mfmailcomposeviewcontroller ×1
mfmessagecomposeviewcontroller ×1
snapchat ×1
uiviewcontrollerrepresentable ×1
xcode ×1