在我进一步了解 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) 我在本地测试 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