材主

Results 74 issues of 材主

[https://github.com/react-component/generator-rc/blob/master/generators/app/templates/package.json#L50](https://github.com/react-component/generator-rc/blob/master/generators/app/templates/package.json#L50) Unexpected token '`,`' after `"babel-runtime": "6.x"` ![image](https://user-images.githubusercontent.com/7159888/34657632-21d7c668-f463-11e7-88f1-b18c4274e21d.png)

最近苹果又双叒叕出了新政了,关于 [Describing use of required reason API](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api) 的问题,2024年5月1号之后,所有用到这些接口的(其实一般都要用到,比如本地存储 `UserDefaults`),都需要新建一个 `PrivacyInfo.xcprivacy` 文件,并把使用到的 API 和相关信息填上。 > PS: Widget 项目也需要单独添加! ## `PrivacyInfo.xcprivacy` 文件添加 参考:[https://developer.apple.com/documentation/bundleresources/privacy_manifest_files#4284009](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files#4284009) ## 解决 ### 方法一:打个包上去提审一次,会驳回并收到包含 ISSUE 邮件 5月1号前提审的应用,会收到如下的提醒邮件,但不影响当次的审核。邮件里面会列出来你哪个包里有哪些API需要声明权限,如下: 再查看文档 [https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api)...

iOS

苹果的文档写的还是不错的,开发前可以多看看官方文档: - [https://developer.apple.com/documentation/technologies](https://developer.apple.com/documentation/technologies) - [SwiftUI](https://developer.apple.com/tutorials/swiftui/) - [hackingwithswift](https://www.hackingwithswift.com/) - [iosexample](https://iosexample.com/) ## 常用记录 - [背景颜色渐变](https://www.hackingwithswift.com/quick-start/swiftui/how-to-render-a-gradient) - [JSON文件读取](https://developer.apple.com/tutorials/swiftui/building-lists-and-navigation) ## 养成好习惯 - 给 `@State` 变量加上 `private`: `@State private var score: Int = 0` -...

iOS

最近整理了下10年前用C语言写的几个经典小游戏,都是基于 Windows 的 `Win-Api` 实现的 [字符界面展示](https://github.com/diamont1001/C_tetris/blob/master/JR_Cursor.c),感觉还是挺有意思的,现在回看代码很多都已经忘记了。 有兴趣的可以去下载体验一下(需要 Windows 机器),每个项目的 `/bin/release` 文件夹下载下来都是编译好可运行的程序。 ## 游戏引擎 所谓游戏“引擎”也是自己实现的,其实就是一个简单的 [定时器](https://github.com/diamont1001/C_tetris/blob/master/JR_timer.c),不停的轮询,每隔一小段时间就去检测一下数据状态,通过数据的改变不停的刷新页面的展示。 ## 游戏开发核心思想 这类小游戏的开发,有几个核心概念:定时器、状态数据、控制器、图形渲染 - 定时器:loop(数据 => 界面展示) - 状态数据:有限状态机、数据 - 控制器:接收外部输入(键盘、鼠标、手柄等),改变数据和游戏状态(不用管界面展示) - 图形渲染:不同的平台和终端,会有不同的渲染引擎(比如这个例子都是基于 `Windows Win-Api`...

C语言

## 计算还有多少天生日 ```swift // 计算距离生日的天数 private func daysToBirthday(birthday: Date) -> Int { // 今天生日的情况(不然后面的计算会误把下个生日算到明年,也就是返回365) if (Calendar.current.dateComponents([.year, .month, .day], from: Date()).month == Calendar.current.dateComponents([.year, .month, .day], from: birthday).month && Calendar.current.dateComponents([.year, .month, .day],...

算法
iOS

## 组件预览 ## 代码 ```swiftui import SwiftUI struct TextButton: View { let title: String let icon: String let color: Color let bold: Bool let radius: CGFloat let fill: Bool //...

iOS

SwiftUI 作为苹果新一代的开发框架,虽然还不很成熟,但是用起来是真的爽,下面记录一下关于 SwiftUI 的组件化开发相关事宜。 ## 新增组件文件 XCode 在这方面做的很好,要引入新文件的话,不用像其他开发语言一样,需要 `import` 文件进来,直接右击文件夹点击添加文件即可,它的包含关系会自动写到 info 文件里去的,非常方便。 ## 组件参数传递,支持某些参数可传可不传 组件的定义在官方文档很容易找的到,但是参数的传递,以及怎么样定义才能让某些参数可传可不传,这个问题之前困扰了我很长时间,下面例子可以实现这个逻辑: MyIcon.swift ```swift import SwiftUI struct MyIcon: View { // 支持传递的参数 var icon: String = "questionmark"...

iOS

苹果应用如果跟付费相关的话,现在是限定要使用 in-app purchase 方式的,也就是应用内购买的方式,还好 SwiftUI 在这块的支持也是挺好的,接入挺方便,下面就介绍下接入的细节。 之前有个 App 尝试过一个【Buy me a coffee】的打赏按扭直接跳 Paypal 的支付链接,第一个版本通过审核了,后面再更新的时候就被拒绝,理由是付费相关需要使用 “in-app purchase” 接入方式。 ### 苹果付费类型 - 消耗品:Consumable - 非消耗品:Non-Consumable - 自动续期的订阅:Auto-Renewable Subscriptions - 不自动续期的订阅:Non-Renewing Subscriptions ##...

iOS

# React Native 项目中添加远程调试支持 步骤1:下载调试器 [react-native-redux-devtools](https://www.atomlab.dev/tutorials/react-native-redux-devtools) 步骤2:项目安装依赖 ```bash npm install @redux-devtools/extension @redux-devtools/remote ``` 步骤3:修改 Redux Store 创建代码,例子如下 ```js import {legacy_createStore as createStore, applyMiddleware} from 'redux' import thunkMiddleware from 'redux-thunk' import...

工具使用
前端工程

很多时候,我们不小心改错了一个文件,但是跟随一个 Commit 已经 Push 上去 Git 服务器了,这时候我们不想回滚整个 Commit,而只想要回滚某个文件,怎么办呢? 步骤1:通过 History 查看该文件的Commit 记录 可以在 Github 或者 Gitlab 上,选择指定分支,然后点击指定文件后,右上角找到 "History"。 ![image](https://github.com/diamont1001/blog/assets/7159888/2abeca2d-14d8-41e6-808a-76b4f93351a2) 步骤2:查看 History,找到你想要回滚的节点,然后复制节点 Hash 值,比如: ![image](https://github.com/diamont1001/blog/assets/7159888/bf10a035-5400-404f-89ad-8c763b934ada) 步骤3:通过 Checkout 命令,把对应修改节点状态下的该文件下载下来,比如: ```bash git checkout...

工具使用