c-villain/YandexMapsMobile
Yandex Maps Mobile full Swift package
Requirements
- iOS 13.0
Swift Package Manager
To integrate YandexMapsMobile into your project using SwiftPM do this 👇🏻
- File > Swift Packages > Add Package Dependency
- Add
https://github.com/c-villain/YandexMapsMobile.git - Select "Up to Next Major" with "4.2.2"
or add the following code to your Package.swift:
dependencies: [
.package(url: "https://github.com/c-villain/YandexMapsMobile", from: "4.2.2"),
],or via XcodeGen insert into your project.yml:
name: YourProjectName
options:
deploymentTarget:
iOS: 13.0
packages:
YandexMapsMobile:
url: https://github.com/c-villain/YandexMapsMobile
from: 4.2.2
targets:
YourTarget:
type: application
...
dependencies:
- package: YandexMapsMobileRecommedations to use
<details> <summary>Using on Apple silicon without Rosetta mode</summary>
- You should init
YMKMapViewwithvulkanPreferred: true
YMKMapView.init(frame: .zero, vulkanPreferred: isM1Simulator())
....
#if targetEnvironment(simulator)
public static func isM1Simulator() -> Bool {
return TARGET_CPU_ARM64 != 0
}
#else
public static func isM1Simulator() -> Bool { false }
#endif
- Call
YMKMapKit.sharedInstance()inAppDelegateas in example
/**
If you create instance of YMKMapKit not in application:didFinishLaunchingWithOptions:
you should also explicitly call YMKMapKit.sharedInstance().onStart()
*/
YMKMapKit.sharedInstance()</details>
<details> <summary>Latest recommendations for project settings</summary>
to build project you should add following linker flags in the Build Settings tab:
frameworks:
"CoreFoundation",
"Foundation",
"CoreLocation",
"UIKit",
"OpenGLES",
"SystemConfiguration",
"CoreGraphics",
"QuartzCore",
"Security",
"CoreTelephony",
"CoreMotion",
"DeviceCheck"
libraries:
"resolv",
"c++"as in the screenshot:
<img width="600" alt="Screenshot 2024-02-09 at 23 33 46" src="https://github.com/c-villain/YandexMapsMobile/assets/6235615/5eb59561-9ddb-45d0-84b3-5051fefce4d3">
</details>
<details> <summary>YandexMapsMobile as subpackage</summary>
If you use YandexMapsMobile as subdependency in your own package you should probably add linkerSettings to the target for successful building:
targets: [
.target(
name: "Your target",
dependencies: [
.product(name: "YandexMapsMobile", package: "YandexMapsMobile")
],
linkerSettings: [ // <===== ‼️LOOK HERE‼️
.linkedFramework("CoreLocation"),
.linkedFramework("CoreTelephony"),
.linkedFramework("SystemConfiguration"),
.linkedLibrary("c++"),
.unsafeFlags(["-ObjC"]),
]),
]or add in the projects settings -ObjC and framework "DeviceCheck":
<img width="705" alt="Screenshot 2024-08-14 at 12 50 31" src="https://github.com/user-attachments/assets/abd65454-0cf2-444c-b97e-943de410db62">
or via XcodeGen insert into your project.yml:
settings:
OTHER_LDFLAGS: -ObjC -framework "DeviceCheck"For more details look here.
</details>
Special thanks
to Igor Makarov for his contributing in the release v.4.0.1
Communication
👨🏻💻 Feel free to subscribe to channel SwiftUI dev in telegram.
If you like this repository, please do :star: to make this useful for others.
Package Metadata
Repository: c-villain/YandexMapsMobile
Homepage: https://t.me/swiftui_dev
Stars: 35
Forks: 8
Open issues: 8
Default branch: main
Primary language: swift
Topics: ios, swiftpm, yandex, yandexmapkit, yandexmaps
README: README.md
Archived: yes