Skip to content

Commit 1cfb826

Browse files
authored
Merge pull request #2 from wflixu/dev
feat: mvp version
2 parents 14465dc + ef8cab4 commit 1cfb826

63 files changed

Lines changed: 1851 additions & 500 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
/*.xcodeproj
5+
xcuserdata/
6+
DerivedData/
7+
.netrc
8+
Build/
9+
10+
# Xcode
11+
*.xcworkspace
12+
*.xcuserstate
13+
*.xccheckout
14+
15+
# Swift Package Manager
16+
.swiftpm/
17+
.build/
18+
19+
# macOS
20+
.DS_Store
21+
.AppleDouble
22+
.LSOverride
23+
24+
# Build artifacts
25+
*.o
26+
*.pyc
27+
*.so
28+
29+
# User settings
30+
*.swp
31+
*.swo
32+
*~
33+
34+
# Local development files
35+
local.*
36+
.env
37+
38+
# Fastlane
39+
fastlane/report.xml
40+
fastlane/Preview.html
41+
fastlane/screenshots
42+
fastlane/test_output

.periphery.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
project: iCap.xcodeproj
2+
retain_public: true
3+
schemes:
4+
- iCap

README.md

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,52 @@
1-
[![Swift 5.9](https://img.shields.io/badge/Swift-5.9-ED523F.svg?style=flat)](https://swift.org/)
2-
[![SwiftUI](https://img.shields.io/badge/SwiftUI-✓-orange)](https://developer.apple.com/xcode/swiftui/)
3-
[![macOS 14](https://img.shields.io/badge/macOS12-Compatible-green)](https://www.apple.com/macos/monterey/)
41

5-
![](./iCap/Assets.xcassets/AppIcon.appiconset/AppIcon@1x.png)
2+
![](iCap/Assets.xcassets/AppIcon.appiconset/icon_128x128.png)
63

4+
# iCap - macOS Screenshot Tool
75

8-
# [WIP] iCap
6+
[![Swift 5.9](https://img.shields.io/badge/Swift-5.10-ED523F.svg?style=flat)](https://swift.org/) [![SwiftUI](https://img.shields.io/badge/SwiftUI-✓-orange)](https://developer.apple.com/xcode/swiftui/) [![macOS 15](https://img.shields.io/badge/macOS15-Compatible-green)](https://www.apple.com/macos/monterey/)
97

10-
A macOS App for screenshot using Latest Swift/SwiftUI and ScreenCapturekit.
8+
[中文版](README_CN.md)
119

10+
A modern macOS screenshot application built with Swift 5.10, SwiftUI and ScreenCaptureKit.
1211

1312
## Features
1413

15-
- [ ] keyboard shortcut to capture screenshot
16-
- [ ] screen area selection
17-
- [ ] save screenshot to local
18-
- [ ] border shadow effect
14+
- [x] Screenshot capture
15+
- [x] Keyboard shortcut support
16+
- [x] Screen area selection
17+
- [ ] Window selection
18+
- [x] Image editing
19+
- [ ] Basic annotations
20+
- [ ] Crop and resize
21+
- [x] Saving options
22+
- [x] Save to local
23+
- [s] Copy to clipboard
24+
- [x] Custom save locations
25+
- [x] UI Enhancements
26+
- [ ] Border shadow effects
27+
- [ ] Customizable UI themes
28+
29+
## Requirements
30+
31+
- macOS 15 or later
32+
- Xcode 15+
33+
- Swift 5.10
34+
35+
## Installation
36+
37+
1. Download the latest release from [Releases](https://github.com/wflixu/iCap/releases)
38+
2. Clone this repository
39+
3. Open in Xcode
40+
4. Build and run
41+
42+
## Contributing
43+
Contributions are welcome! Please submit a pull request or open an issue for any bugs or feature requests.
44+
45+
## Feedback & Support
46+
If you encounter any issues or have suggestions, please open an [issue](https://github.com/wflixu/iCap/issues) on GitHub.
47+
48+
## License
49+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
1950

2051

2152

README_CN.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
![](iCap/Assets.xcassets/AppIcon.appiconset/icon_128x128.png)
2+
3+
# iCap - macOS 截图工具
4+
5+
[![Swift 5.9](https://img.shields.io/badge/Swift-5.10-ED523F.svg?style=flat)](https://swift.org/) [![SwiftUI](https://img.shields.io/badge/SwiftUI-✓-orange)](https://developer.apple.com/xcode/swiftui/) [![macOS 15](https://img.shields.io/badge/macOS15-Compatible-green)](https://www.apple.com/macos/monterey/)
6+
[English Version](README.md)
7+
8+
9+
一款基于 Swift 5.10、SwiftUI 和 ScreenCaptureKit 构建的现代化 macOS 截图应用。
10+
11+
## 功能特性
12+
13+
- [x] 截图功能
14+
- [x] 快捷键支持
15+
- [x] 屏幕区域选择
16+
- [ ] 窗口选择
17+
- [x] 图片编辑
18+
- [ ] 基础标注
19+
- [ ] 裁剪和调整大小
20+
- [x] 保存选项
21+
- [x] 保存到本地
22+
- [ ] 复制到剪贴板
23+
- [x] 自定义保存位置
24+
- [x] 界面增强
25+
- [ ] 边框阴影效果
26+
- [ ] 可定制的UI主题
27+
28+
## 系统要求
29+
30+
- macOS 15 或更高版本
31+
- Xcode 15+
32+
- Swift 5.10
33+
34+
## 安装指南
35+
36+
1.[Releases](https://github.com/yourusername/iCap/releases)下载最新版本
37+
2. 克隆本仓库
38+
3. 在Xcode中打开
39+
4. 构建并运行
40+
41+
## 反馈与支持
42+
43+
如果您遇到任何问题或有建议,请在GitHub上提交 [issue](https://github.com/wflixu/iCap/issues)
44+
45+
46+
我们欢迎所有反馈来改进iCap!

iCap.xcodeproj/project.pbxproj

Lines changed: 133 additions & 86 deletions
Large diffs are not rendered by default.

iCap.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 0 additions & 14 deletions
This file was deleted.

iCap.xcodeproj/xcshareddata/xcschemes/iCap.xcscheme

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1520"
3+
LastUpgradeVersion = "1620"
44
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
8+
<PreActions>
9+
<ExecutionAction
10+
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
11+
<ActionContent
12+
title = "Run Script"
13+
scriptText = "&#10;">
14+
<EnvironmentBuildable>
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "5CF3D9802B63B25B00753013"
18+
BuildableName = "iCap.app"
19+
BlueprintName = "iCap"
20+
ReferencedContainer = "container:iCap.xcodeproj">
21+
</BuildableReference>
22+
</EnvironmentBuildable>
23+
</ActionContent>
24+
</ExecutionAction>
25+
</PreActions>
826
<BuildActionEntries>
927
<BuildActionEntry
1028
buildForTesting = "YES"
@@ -35,7 +53,7 @@
3553
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
3654
launchStyle = "0"
3755
useCustomWorkingDirectory = "NO"
38-
ignoresPersistentStateOnLaunch = "NO"
56+
ignoresPersistentStateOnLaunch = "YES"
3957
debugDocumentVersioning = "YES"
4058
debugServiceExtension = "internal"
4159
allowLocationSimulation = "YES">
@@ -55,6 +73,7 @@
5573
shouldUseLaunchSchemeArgsEnv = "YES"
5674
savedToolIdentifier = ""
5775
useCustomWorkingDirectory = "NO"
76+
ignoresPersistentStateOnLaunch = "YES"
5877
debugDocumentVersioning = "YES">
5978
<BuildableProductRunnable
6079
runnableDebuggingMode = "0">
@@ -71,7 +90,25 @@
7190
buildConfiguration = "Debug">
7291
</AnalyzeAction>
7392
<ArchiveAction
74-
buildConfiguration = "Release"
93+
buildConfiguration = "Debug"
7594
revealArchiveInOrganizer = "YES">
95+
<PreActions>
96+
<ExecutionAction
97+
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
98+
<ActionContent
99+
title = "Run Script"
100+
scriptText = "cd /Users/lixu/code/iCap&#10;&#10;agvtool next-version -all&#10;">
101+
<EnvironmentBuildable>
102+
<BuildableReference
103+
BuildableIdentifier = "primary"
104+
BlueprintIdentifier = "5CF3D9802B63B25B00753013"
105+
BuildableName = "iCap.app"
106+
BlueprintName = "iCap"
107+
ReferencedContainer = "container:iCap.xcodeproj">
108+
</BuildableReference>
109+
</EnvironmentBuildable>
110+
</ActionContent>
111+
</ExecutionAction>
112+
</PreActions>
76113
</ArchiveAction>
77114
</Scheme>

iCap/.gitignore

Lines changed: 0 additions & 9 deletions
This file was deleted.

iCap/AppDelegate.swift

Lines changed: 0 additions & 37 deletions
This file was deleted.

iCap/AppState.swift

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//
2+
// AppState.swift
3+
// iCap
4+
//
5+
// Created by 李旭 on 2025/1/17.
6+
//
7+
8+
import AppKit
9+
import Combine
10+
import KeyboardShortcuts
11+
12+
@MainActor
13+
class AppState: ObservableObject {
14+
@AppLog(category: "AppState")
15+
private var logger
16+
17+
@Published
18+
var isUnicornMode: Bool = false
19+
// overlayer is show
20+
@Published
21+
var isShow: Bool = false
22+
23+
init() {
24+
// KeyboardShortcuts.onKeyUp(for: .startScreenShot) { [self] in
25+
// print("------\(self.self)")
26+
// self.takeScreenShot()
27+
// }
28+
}
29+
30+
static var share = AppState()
31+
32+
@MainActor
33+
func takeScreenShot() {
34+
print("takeScreenShot")
35+
Task {
36+
if (try? await SCContext.getScreenImage()) != nil {
37+
self.logger.info("takeScreenShot success")
38+
}
39+
}
40+
}
41+
42+
func setIsShow(_ isShow: Bool) {
43+
self.logger.info("start show overlayer")
44+
self.isShow = isShow
45+
}
46+
47+
func hideOverlayerWin() {
48+
print("start hide overlayer")
49+
self.isShow = false
50+
if let window = NSApplication.shared.windows.first(where: { $0.title == "Item-0" }) {
51+
window.close()
52+
} else {
53+
print("hide overlayer failed - window not found")
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)