学计算机的那个

不是我觉到、悟到,你给不了我,给了也拿不住;只有我觉到、悟到,才有可能做到,能做到的才是我的.

0%

Publisher

发布者向一个或多个订阅者发送值。它们遵循Publisher协议,并声明输出的类型和它们产生的任何错误:

1
2
3
4
5
public protocol Publisher {
associatedtype Output
associatedtype Failure : Error
func receive<S>(subscriber: S) where S : Subscriber, Self.Failure == S.Failure, Self.Output == S.Input
}

发布者可以随时间发送任意数量的值,也可以发送错误而失败。关联类型Output定义发布者可以发送哪些类型的值,而关联类型Failure定义它可能失败的错误类型。发布者可以通过指定never关联类型来声明它永远不会失败。

阅读全文 »

通过组合 事件处理操作符 自定义异步事件的处理。

Customize handling of asynchronous events by combining event-processing operators.

阅读全文 »

Getting Started

SwiftUI’s reactive state management makes this a lot easier by introducing the notion of a source of truth that can be shared across your app using SwiftUI’s property wrappers such as @EnvironmentObject, @ObservedObject, and @StateObject

the notion of a source of truth 事实源
This source of truth usually is your in-memory data model

In this series, we will look at how to use Combine in the context of SwiftUI to

  • access the network,
  • map data,
  • handle errors
阅读全文 »

Scene

A scene contains the view hierarchy of your app.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import SwiftUI


@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
TabView {
ContentView()
.tabItem {
Label("Journal", systemImage: "book")
}
SettingsView()
.tabItem {
Label("Settings", systemImage: "gear")
}
}
}
}
}

In this sample, body returns the primary scene WindowGroup, which describes the view hierarchy of the sample’s main window.

WindowGroup: It provides platform-specific behaviors for your app, such as supporting multiple windows in macOS and iPadOS.

The computed body property can return one or more primary and secondary scenes.

阅读全文 »

常用的宏方法

@main

The @main attribute identifies the app’s entry point.

1
2
3
4
5
6
7
8
9
10
11
import SwiftUI


@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}

The entry point is responsible for the start up of the app.

The MyApp structure conforms to the App protocol,

The structure implements the computed property body, which is a requirement of the App protocol.

SwiftUI provides different types of scenes including WindowGroup, Window, DocumentGroup, and Settings

阅读全文 »

一些在后台运行的任务,需要在特定条件下对用户发起通知,如果有跨端要求,可以用第三方库,不过需要付费,优势在于可同时兼容移动端和桌面端,这里只是个人使用,所以推荐使用Mac自带Apple Script来添加,本来考虑通过向Reminders添加Event的方式,实现Mack & iOS同时提醒,不过只找到OC和Swift的API,没找到Py的API

阅读全文 »

机器学习是人工智能的一个分支。人工智能的研究历史有着一条从以“推理”为重点,到以“知识”为重点,再到以“学习”为重点的自然、清晰的脉络。

机器学习是实现人工智能的一个途径之一,即以机器学习为手段,解决人工智能中的部分问题。

阅读全文 »