Skip to content

Commit 5339d72

Browse files
committed
Add initial project structure with .gitignore, Package.swift, and submodule configuration
1 parent a8357f6 commit 5339d72

File tree

5 files changed

+49
-0
lines changed

5 files changed

+49
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.build/
2+
.swift-version

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "Sources/libnativeapi"]
2+
path = Sources/libnativeapi
3+
url = https://github.com/leanflutter/libnativeapi.git

Package.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// swift-tools-version:6.0
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "nativeapi",
6+
targets: [
7+
.executableTarget(
8+
name: "Example",
9+
dependencies: ["libnativeapi"],
10+
swiftSettings: [
11+
.interoperabilityMode(.Cxx)
12+
]
13+
),
14+
.target(
15+
name: "libnativeapi",
16+
exclude: [
17+
"examples",
18+
"src/screen_retriever_linux.cpp",
19+
"src/screen_retriever_linux.h",
20+
"src/screen_retriever_windows.cpp",
21+
"src/screen_retriever_windows.h",
22+
],
23+
linkerSettings: [
24+
.linkedFramework("Cocoa"),
25+
.linkedFramework("Foundation")
26+
]
27+
),
28+
],
29+
cxxLanguageStandard: .cxx17
30+
)

Sources/Example/main.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import libnativeapi
2+
3+
var screenRetriever = ScreenRetrieverMacOS()
4+
let cursorPoint = screenRetriever.GetCursorScreenPoint()
5+
let primaryDisplay = screenRetriever.GetPrimaryDisplay()
6+
let allDisplays = screenRetriever.GetAllDisplays()
7+
8+
print(cursorPoint)
9+
print(primaryDisplay)
10+
print(allDisplays)
11+
12+
print(String(cString: primaryDisplay.id))
13+
print(String(cString: primaryDisplay.name))

Sources/libnativeapi

Submodule libnativeapi added at 04d4678

0 commit comments

Comments
 (0)