Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
623 changes: 623 additions & 0 deletions ios-search-sdk-uikit/ios-search-sdk-uikit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 82 additions & 0 deletions ios-search-sdk-uikit/ios-search-sdk-uikit/AnnotationView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//
// AnnotationView.swift
// ios-search-sdk-uikit
//
// Created by emilyryan on 7/29/25.
//


import Foundation
import UIKit
import MapboxSearch
import MapboxSearchUI
import MapboxMaps

// `AnnotationView` is a custom `UIView` subclass which is used only for annotation demonstration
class AnnotationView: UIView {

var onSelect: ((Bool) -> Void)?
var onClose: (() -> Void)?

var selected: Bool = false {
didSet {
vStack.spacing = selected ? 20 : 4
onSelect?(selected)
}
}

var title: String? {
get { centerLabel.text }
set { centerLabel.text = newValue }
}

lazy var centerLabel: UILabel = {
let label = UILabel(frame: .zero)
label.font = UIFont.systemFont(ofSize: 10)
label.numberOfLines = 0
return label
}()

private let vStack: UIStackView

override init(frame: CGRect) {
vStack = UIStackView()
super.init(frame: frame)
backgroundColor = .white
layer.shadowOpacity = 0.25
layer.shadowRadius = 8
layer.shadowOffset = CGSize(width: 0, height: 2)
layer.cornerRadius = 8

let hStack = UIStackView(arrangedSubviews: [centerLabel])
hStack.spacing = 4

vStack.addArrangedSubview(hStack)
vStack.axis = .vertical
vStack.translatesAutoresizingMaskIntoConstraints = false
vStack.spacing = 4
addSubview(vStack)
NSLayoutConstraint.activate([
vStack.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 4),
vStack.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -4),
vStack.topAnchor.constraint(equalTo: topAnchor, constant: 4),
vStack.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -4),
])

}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

// MARK: - Action handlers

@objc private func closePressed(sender: UIButton) {
onClose?()
}

@objc private func selectPressed(sender: UIButton) {
selected.toggle()
}

}
36 changes: 36 additions & 0 deletions ios-search-sdk-uikit/ios-search-sdk-uikit/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// AppDelegate.swift
// ios-search-sdk-uikit
//
// Created by emilyryan on 7/29/25.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "tinted"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "dest-pin.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//
// BottomSheetUIView.swift
// ios-search-sdk-uikit
//
// Created by emilyryan on 7/29/25.
//


import UIKit

class BottomSheetUIView: UIView {

public lazy var nameLabel: UILabel = {
let label = UILabel()
label.text = "NAME"
label.font = UIFont.systemFont(ofSize: 24)
label.textColor = .white
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()

public lazy var addressLabel: UILabel = {
let label = UILabel()
label.text = "ADDRESS"
label.font = UIFont.systemFont(ofSize: 24)
label.textColor = .white
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()

override init(frame: CGRect) {
super.init(frame: frame)

setupViewHierarchy()
setupViewAttributes()
setupLayout()
setHidden(hidden:true)
let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleTap(_:)))
addGestureRecognizer(tap)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func setupViewHierarchy(){
self.addSubview(nameLabel)
self.addSubview(addressLabel)
}

func setupViewAttributes(){
self.backgroundColor = .black
self.layer.cornerRadius = 20
}

func setupLayout(){
NSLayoutConstraint.activate([
nameLabel.centerXAnchor.constraint(equalTo: self.centerXAnchor),
nameLabel.topAnchor.constraint(equalTo: self.topAnchor, constant: 50),
addressLabel.centerXAnchor.constraint(equalTo: self.centerXAnchor),
addressLabel.topAnchor.constraint(equalTo: self.topAnchor, constant: 100)
])

}

func setHidden(hidden: Bool)
{
self.isHidden = hidden
}

@objc func handleTap(_ sender: UITapGestureRecognizer? = nil) {
if(!self.isHidden)
{
setHidden(hidden: true)
}
}
}
Loading