小编Col*_*gic的帖子

Firebase 将多个子域托管到具有 1 个项目的应用目录

我目前有一个应用程序部署到 Firebase 托管,其结构如下:

public/
    appSub1/
        index.html
    appSub2
        index.html
    index.html
Run Code Online (Sandbox Code Playgroud)

我已经添加并连接了我的子域,以便

appSub1.mysite.com/ -> app.firebaseapp.com/
appSub2.mysite.com/ -> app.firebaseapp.com/
Run Code Online (Sandbox Code Playgroud)

我正在尝试配置重定向以将子域与正确的应用程序子文件夹正确关联,以便

appSub1.mysite.com/ -> app.firebaseapp.com/appSub1/
appSub2.mysite.com/ -> app.firebaseapp.com/appSub2/
Run Code Online (Sandbox Code Playgroud)

如果我手动添加子路径,应用程序仍然可以正确显示,但没有它们就不行。所以会以appSub1.mysite.com/空白页appSub1.mysite.com/appSub1/结束,但会以正确的方式结束index.html

这是我当前的托管配置 firebase.json

"hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "appSub1.mysite.com/**",
        "destination": "/appSub1/**",
        "type": 301
      },
      {
        "source": "appSub2.mysite.com/**",
        "destination": "/appSub2/**",
        "type": 301
      }
    ]
  },
Run Code Online (Sandbox Code Playgroud)

subdomain dns firebase firebase-hosting

9
推荐指数
1
解决办法
2486
查看次数

RealityKit - 为 ModelEntity 的不透明度设置动画?

model通过在a 的属性上设置材质的颜色ModelEntity,我可以更改对象的不透明度/alpha。但如何将其动画化呢?我的目标是使对象具有完全不透明度的动画,然后让它们淡入设定的不透明度,例如 50%。

有了SCNAction.fadeOpacityin ,这变得特别容易SCNNodeSceneKit

let fade = SCNAction.fadeOpacity(by: 0.5, duration: 0.5)
node.runAction(fade)
Run Code Online (Sandbox Code Playgroud)

AnEntity符合HasTransform,但这仅允许您对比例、位置和方向进行动画处理。与淡入或淡出之类的材质动画无关。如果您创建用于动画隐藏或显示的行为,则效果在 RealityComposer 中,但似乎没有类似的功能来HasTransform提供动画不透明度的功能。

我一直在文档中寻找一些东西,我的下一个想法本质上是创建一个自定义动画来替换这种行为,但它似乎应该可用,但我只是没有找到它。

augmented-reality swift arkit realitykit reality-composer

8
推荐指数
1
解决办法
2437
查看次数

您如何调试Firestore安全规则?

我在哭自己要睡这个。

getAfter返回的对象只有一个字段,因为其他所有字段类型都不正确。我不知道如何在没有任何调试工具的情况下进行检查(我看不到数据,因此只能进行猜测和检查)。

这是我的规则的精简版本users

match /users/{userId} {
  function isValidUser(user) {
    return user.id is string &&
       (user.address is string || user.address == null) &&
       (user.dateOfBirth is number || user.dateOfBirth == null) &&
       user.email is string &&
       user.name is string &&
       (user.phoneNumber is string || user.phoneNumber == null);
  }

  function isValidWrite(userId, user) {
    return signedIn() && 
        writeHasMatchingId(userId, user) &&
        isValidUser(user);
  }

  allow read: if signedIn();
  allow create: if signedInAndWriteHasMatchingId(userId) &&
    userHasId(userId) &&
    isValidUser(request.resource.data); // Tested
  allow update: if isValidWrite( …
Run Code Online (Sandbox Code Playgroud)

firebase google-cloud-firestore firebase-security-rules

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

Swift Codable-解码嵌套字典

可以说我有一本这样的字典:

{"user_data":{"id":3,"name":"Damian D","email":"aaa@aaa.pl"},"status":true}
Run Code Online (Sandbox Code Playgroud)

我如何使用Codable协议将其解码user_datastruct

struct User: Codable {
    private enum CodingKeys: String, CodingKey {
        case id
        case username = "name"
        case email
    }

    let id:       Int
    let username: String
    let email:    String
}
Run Code Online (Sandbox Code Playgroud)

我是否需要将此子词典转换为数据,还是有更简单的方法?

serialization swift swift4 codable

3
推荐指数
1
解决办法
1877
查看次数