Skip to content

Commit 7e702d2

Browse files
authored
Merge pull request #360 from silvanshade/webkit-example
Add webkit example
2 parents 42b9538 + 6aeaf7d commit 7e702d2

File tree

4 files changed

+357
-20
lines changed

4 files changed

+357
-20
lines changed

crates/icrate/Cargo.toml

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,37 +48,31 @@ targets = [
4848
[[example]]
4949
name = "basic_usage"
5050
required-features = [
51-
"Foundation",
52-
"Foundation_NSArray",
53-
"Foundation_NSDictionary",
54-
"Foundation_NSEnumerator",
51+
"unstable-example-basic_usage"
5552
]
5653

5754
[[example]]
5855
name = "delegate"
5956
required-features = [
60-
"apple",
61-
"Foundation",
62-
"Foundation_NSString",
63-
"AppKit_NSResponder",
57+
"unstable-example-delegate"
6458
]
6559

6660
[[example]]
6761
name = "speech_synthesis"
6862
required-features = [
69-
"apple",
70-
"Foundation",
71-
"Foundation_NSString",
63+
"unstable-example-speech_synthesis"
7264
]
7365

7466
[[example]]
7567
name = "nspasteboard"
7668
required-features = [
77-
"apple",
78-
"Foundation",
79-
"Foundation_NSArray",
80-
"Foundation_NSDictionary",
81-
"Foundation_NSString",
69+
"unstable-example-nspasteboard"
70+
]
71+
72+
[[example]]
73+
name = "browser"
74+
required-features = [
75+
"unstable-example-browser"
8276
]
8377

8478
[features]
@@ -117,6 +111,54 @@ unstable-private = []
117111
# https://github.com/madsmtm/objc2/issues/new
118112
unstable-static-nsstring = []
119113

114+
# Examples
115+
116+
unstable-example-basic_usage = [
117+
"Foundation",
118+
"Foundation_NSArray",
119+
"Foundation_NSDictionary",
120+
"Foundation_NSEnumerator",
121+
]
122+
unstable-example-delegate = [
123+
"apple",
124+
"Foundation",
125+
"Foundation_NSString",
126+
"AppKit",
127+
"AppKit_NSResponder",
128+
]
129+
unstable-example-speech_synthesis = [
130+
"apple",
131+
"Foundation",
132+
"Foundation_NSString",
133+
]
134+
unstable-example-nspasteboard = [
135+
"apple",
136+
"Foundation",
137+
"Foundation_NSArray",
138+
"Foundation_NSDictionary",
139+
"Foundation_NSString",
140+
]
141+
unstable-example-browser = [
142+
"apple",
143+
"AppKit",
144+
"AppKit_NSButton",
145+
"AppKit_NSColor",
146+
"AppKit_NSMenu",
147+
"AppKit_NSMenuItem",
148+
"AppKit_NSStackView",
149+
"AppKit_NSTextAttachmentCell",
150+
"AppKit_NSTextField",
151+
"AppKit_NSTextView",
152+
"AppKit_NSWindow",
153+
"Foundation",
154+
"Foundation_NSString",
155+
"Foundation_NSURL",
156+
"Foundation_NSURLRequest",
157+
"WebKit",
158+
"WebKit_WKNavigation",
159+
"WebKit_WKWebView",
160+
]
161+
120162
# Frameworks
121163

122164
Accessibility = ["Foundation"]
@@ -213,14 +255,14 @@ WebKit = [
213255
]
214256

215257
# Helps with CI
216-
unstable-frameworks-all = ["unstable-frameworks-ios", "unstable-frameworks-macos-13"]
258+
unstable-frameworks-all = ["unstable-frameworks-ios", "unstable-frameworks-macos-13", "unstable-example-basic_usage"]
217259
unstable-frameworks-gnustep = ["AppKit_all", "Foundation_all"]
218260
unstable-frameworks-gnustep-32bit = ["Foundation_all"]
219-
unstable-frameworks-ios = ["Accessibility_all", "AdServices_all", "AdSupport_all", "AuthenticationServices_all", "AutomaticAssessmentConfiguration_all", "BackgroundAssets_all", "BackgroundTasks_all", "BusinessChat_all", "CallKit_all", "ClassKit_all", "CloudKit_all", "Contacts_all", "CoreData_all", "CoreAnimation_all", "CoreLocation_all", "DataDetection_all", "DeviceCheck_all", "EventKit_all", "ExtensionKit_all", "ExternalAccessory_all", "FileProvider_all", "FileProviderUI_all", "Foundation_all", "GameController_all", "GameKit_all", "IdentityLookup_all", "LocalAuthentication_all", "LinkPresentation_all", "MapKit_all", "Metal_all", "MetalKit_all", "SoundAnalysis_all", "Speech_all", "StoreKit_all", "UniformTypeIdentifiers_all", "UserNotifications_all", "WebKit_all"]
220-
unstable-frameworks-macos-10-7 = ["Accessibility_all", "AppKit_all", "Automator_all", "CoreAnimation_all", "CoreData_all", "CoreLocation_all", "ExceptionHandling_all", "Foundation_all", "InputMethodKit_all", "OSAKit_all", "StoreKit_all", "WebKit_all"]
261+
unstable-frameworks-ios = ["Accessibility_all", "AdServices_all", "AdSupport_all", "AuthenticationServices_all", "AutomaticAssessmentConfiguration_all", "BackgroundAssets_all", "BackgroundTasks_all", "BusinessChat_all", "CallKit_all", "ClassKit_all", "CloudKit_all", "Contacts_all", "CoreData_all", "CoreAnimation_all", "CoreLocation_all", "DataDetection_all", "DeviceCheck_all", "EventKit_all", "ExtensionKit_all", "ExternalAccessory_all", "FileProvider_all", "FileProviderUI_all", "Foundation_all", "GameController_all", "GameKit_all", "IdentityLookup_all", "LocalAuthentication_all", "LinkPresentation_all", "MapKit_all", "Metal_all", "MetalKit_all", "SoundAnalysis_all", "Speech_all", "StoreKit_all", "UniformTypeIdentifiers_all", "UserNotifications_all", "WebKit_all", "unstable-example-speech_synthesis"]
262+
unstable-frameworks-macos-10-7 = ["Accessibility_all", "AppKit_all", "Automator_all", "CoreAnimation_all", "CoreData_all", "CoreLocation_all", "ExceptionHandling_all", "Foundation_all", "InputMethodKit_all", "OSAKit_all", "StoreKit_all", "unstable-example-delegate", "unstable-example-nspasteboard", "unstable-example-speech_synthesis"]
221263
unstable-frameworks-macos-10-13 = ["unstable-frameworks-macos-10-7", "BusinessChat_all", "CloudKit_all", "Contacts_all", "EventKit_all", "ExternalAccessory_all", "GameController_all", "GameKit_all", "LocalAuthentication_all", "LocalAuthenticationEmbeddedUI_all", "MapKit_all", "MetalKit_all"]
222264
unstable-frameworks-macos-11 = ["unstable-frameworks-macos-10-13", "AdServices_all", "AdSupport_all", "AuthenticationServices_all", "AutomaticAssessmentConfiguration_all", "ClassKit_all", "DeviceCheck_all", "FileProvider_all", "FileProviderUI_all", "LinkPresentation_all", "Metal_all", "SoundAnalysis_all", "Speech_all", "UniformTypeIdentifiers_all", "UserNotifications_all"]
223-
unstable-frameworks-macos-12 = ["unstable-frameworks-macos-11", "DataDetection_all", "LocalAuthenticationEmbeddedUI_all", "MailKit_all"]
265+
unstable-frameworks-macos-12 = ["unstable-frameworks-macos-11", "DataDetection_all", "LocalAuthenticationEmbeddedUI_all", "MailKit_all", "WebKit_all", "unstable-example-browser"]
224266
unstable-frameworks-macos-13 = ["unstable-frameworks-macos-12", "BackgroundAssets_all", "BackgroundTasks_all", "CallKit_all", "ExtensionKit_all", "IdentityLookup_all", "MetalFX_all"]
225267

226268
# Temporary fixes until we can autogenerate these

crates/icrate/examples/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#### Running the examples
2+
3+
The examples can be run as follows:
4+
5+
```sh
6+
cargo run --package=icrate --example=basic_usage --features=unstable-example-basic_usage
7+
cargo run --package=icrate --example=delegate --features=unstable-example-delegate
8+
```

0 commit comments

Comments
 (0)