Skip to content

Commit 79efdda

Browse files
committed
Merge branch 'main' of github.com:segmentio/analytics-swift
2 parents d09054b + 77fb12f commit 79efdda

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

Examples/README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
The files contained within this directory are NOT SUPPORTED by Segment.
2-
They are here merely as an example, and for your convenience should you
1+
Note: The files contained within this directory are NOT SUPPORTED by Segment.
2+
They are here merely as an example, and for your convenience should you
33
find it useful.
44

5-
---
5+
# How this folder is structured
6+
7+
- [apps](apps)
8+
Example projects which showcase analytics instrumentation on different platforms/languages
9+
10+
- [Destination Plugins](destination_plugins)
11+
A collection of Sample Destination plugins, and how to include them in your own projects
12+
13+
- [Other Plugins](other_plugins) & [Task Plugins](tasks)
14+
A collection of plugins to help solve common use-cases
15+
16+
---
617
MIT License
718

819
Copyright (c) 2021 Segment

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ The hassle-free way to add Segment analytics to your Swift app (iOS/tvOS/watchOS
4444

4545
You can find usage documentation at [https://segment.com/docs/sources/mobile/swift-ios/](https://segment.com/docs/sources/mobile/swift-ios/).
4646

47+
Explore more via the [example projects](Examples) which showcase analytics instrumentation on different platforms/languages and usage of plugins. These projects contain sample [plugins](Examples/other_plugins) and [destination plugins](Examples/destination_plugins)
48+
4749
## Contributing
4850

4951
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

Sources/Segment/Plugins/Platforms/Vendors/AppleUtils.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ internal class iOSVendorSystem: VendorSystem {
6565

6666
override var userAgent: String? {
6767
#if !os(tvOS)
68-
return WKWebView().value(forKey: "userAgent") as? String
68+
var userAgent: String?
69+
DispatchQueue.main.sync {
70+
userAgent = WKWebView().value(forKey: "userAgent") as? String
71+
}
72+
return userAgent
6973
#else
7074
// webkit isn't on tvos
7175
return "unknown"
@@ -228,7 +232,11 @@ internal class MacOSVendorSystem: VendorSystem {
228232
}
229233

230234
override var userAgent: String? {
231-
return WKWebView().value(forKey: "userAgent") as? String
235+
var userAgent: String?
236+
DispatchQueue.main.sync {
237+
userAgent = WKWebView().value(forKey: "userAgent") as? String
238+
}
239+
return userAgent
232240
}
233241

234242
override var connection: ConnectionStatus {

0 commit comments

Comments
 (0)