小编Ole*_* G.的帖子

SwiftUI - 滑动文本动画和定位

在我进一步了解 SwiftUI 的过程中,我仍然对将我的元素定位在ZStack.

目标是“简单”,我想要一个文本,如果文本太长,它会在定义的区域内滑动。假设我有一个 50px 的区域,文本需要 100。我希望文本从右向左滑动,然后从左向右滑动。

目前,我的代码如下所示:

struct ContentView: View {
    @State private var animateSliding: Bool = false
    private let timer = Timer.publish(every: 1, on: .current, in: .common).autoconnect()
    private let slideDuration: Double = 3
    private let text: String = "Hello, World! My name is Oleg and I would like this text to slide!"

    var body: some View {
        GeometryReader(content: { geometry in
            VStack(content: {
                Text("Hello, World! My name is Oleg!")
                    .font(.system(size: 20))
                    .id("SlidingText-Animation")
                    .alignmentGuide(VerticalAlignment.center, computeValue: { $0[VerticalAlignment.center] …
Run Code Online (Sandbox Code Playgroud)

uiviewanimation swift swiftui swiftui-animation

5
推荐指数
1
解决办法
1003
查看次数

Firebase 本地使用配置变量不起作用 - 错误:缺少格子“秘密”

我在本地测试 firebase 功能时遇到问题。我有一些我想保护的关键 api 密钥。所以为此我使用functions.config().

当使用firebase emulators:start或本地启动您的函数服务器firebase emulators:start --only functions时,secret当使用functions.config().plaid.secret.

我曾经firebase functions:config:get > .runtimeconfig.json将我的配置带到本地。我在我的functions文件夹中运行它。

.runtimeconfig.json文件如下所示:

{
  "plaid": {
    "secret": "blabla",
    "clientid": "blabla"
  }
}
Run Code Online (Sandbox Code Playgroud)

我的index.js看起来如下:

// Using Express
const express = require('express');
const app = express();
app.use(express.json());

// Cloud Functions
const functions = require("firebase-functions");

// Cloud Firestore
const admin = require("firebase-admin");
admin.initializeApp();
const database = admin.firestore();

// Plaid
const plaid = require("plaid"); …
Run Code Online (Sandbox Code Playgroud)

node.js firebase plaid google-cloud-functions google-cloud-firestore

5
推荐指数
1
解决办法
221
查看次数