• Stars
    star
    129
  • Rank 279,262 (Top 6 %)
  • Language
    Swift
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Radar style view written in swift

Sonar logo

Sonar

Version License Platform

Simple radar style view, written in Swift, pure CoreAnimation (no images). Highly adjustable.

Usage

Just place the UIView somewhere in your controller and make it SonarView class.

SonarView copies the data source and delegate patter from UITableView.

/// Data source
public weak var dataSource: SonarViewDataSource?

/// SonarViewDelegate and SonarViewLayout
public weak var delegate: SonarViewDelegate?

There are three required methods.

public protocol SonarViewDataSource: class {
    func numberOfWaves(sonarView: SonarView) -> Int
    func sonarView(sonarView: SonarView, numberOfItemForWaveIndex waveIndex: Int) -> Int
    func sonarView(sonarView: SonarView, itemViewForWave waveIndex: Int, atIndex: Int) -> SonarItemView
}

SonarItemView is just a UIView subclass. In order to use your custom view in radar, make your view SonarItemView subclass. The size of view is determined via layout. The layout is defined by SonarViewLayout protocol. Sonar comes with one predefined layout - SonarViewCenteredLayout. The items in a wave are placed from edges to the center, for example if we have 4 items in wave, first is placed at the left side, second at the right side, third at the left again but a right from the first one and so on. I know, the image would be better:

If you need different behaviour, you can of course create your own layout by adopting the SonarViewLayout and pass it to the SonarView. See SonarViewLayout for more information.

The last protocol is Delegate which handles selections and titles on each wave

public protocol SonarViewDelegate: class {
    func sonarView(sonarView: SonarView, didSelectObjectInWave waveIndex: Int, atIndex: Int)
    func sonarView(sonarView: SonarView, textForWaveAtIndex waveIndex: Int) -> String?
}

If distanceForWaveAtIndex returns nil, the label will be hidden. For more information see the Example project.

Appearance

There are 3 colours that can be adjusted.

class public var lineColor: UIColor
class public var lineShadowColor: UIColor
class public var distanceTextColor: UIColor

Contribution

If you need to expose another properties or you have ideas how to improve it, file issue or send pull request, I'll be happy to discuss it.

Requirements

iOS 8+,

Version 2.x - Swift 2.2+

Version 3.x - Swift 3.0+

Version 4.x - Swift 4.2+

Version 5.x - Swift 5.0+

Installation

Sonar is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Sonar"

Author

Aleลก Kocur, [email protected]

License

Sonar is available under the MIT license. See the LICENSE file for more info.

More Repositories

1

donut

Doughnut-like graph view capable of displaying multiple datasets with assignable colors
Kotlin
541
star
2

hauler

Library with swipe to dismiss Activity gesture implementation
Kotlin
434
star
3

TFBubbleItUp

Custom view for writing tags, contacts and etc. - written in Swift
Swift
330
star
4

arkitekt

Arkitekt is a set of architectural tools based on Android Architecture Components, which gives you a solid base to implement the concise, testable and solid application.
Kotlin
123
star
5

TFTransparentNavigationBar

Custom transition between controllers in UINavigationController that makes navigation bar transparent on specified controllers
Swift
46
star
6

sheet-happens

Gradle plugin for generating Android / KMP string resources from Google Spreadsheets.
Kotlin
45
star
7

arkitekt-kmm

KMM library for UseCase abstraction
Kotlin
44
star
8

iOS-templates

Templates for MVVM-C architecture
Makefile
32
star
9

FuntastyKit

A collection of Swift utilities and protocols used in our projects
Swift
30
star
10

MVVM-C-Example

Example project for MVVM-C architecture in Swift
Swift
29
star
11

infinity

[Deprecated] Infinite paginated RecyclerView scrolling
Java
27
star
12

kmp-futured-template

Template for creating Kotlin Multiplatform applications at Futured.
Kotlin
20
star
13

FTAPIKit

Declarative and generic REST API framework using Codable.
Swift
19
star
14

Engineering-Handbook

Best practices and guidelines for developing apps in Futured
15
star
15

Gutenberg

Tiny library for generating attributed string with emoticons as images
Shell
14
star
16

bitrise-step-apk-info

Ruby
11
star
17

CellKit

Table View and Collection View data source wrapper
Swift
10
star
18

FormStateKit

A Swift package for simple management of forms and their fields. Focused on SwiftUI.
Swift
9
star
19

FTPropertyWrappers

Property wrappers for User Defaults, Keychain, StoredSubject and synchronization.
Swift
8
star
20

TFTableDescriptor

iOS Library / Simple table descriptor with dynamic cell height support
Objective-C
6
star
21

taste

[Deprecated]
Java
6
star
22

LocationManager

Swift
6
star
23

danger

The Danger rules we use at @futuredapp
Ruby
6
star
24

tasting

Android UI Automator wrapper for human-like scenario testing
Kotlin
6
star
25

Monkey-Madness

Easy to use ADB monkey command line wrapper
Shell
6
star
26

bitrise-step-ipa-info

Ruby
5
star
27

Funtasty-iOS-Playbook

Conventions for writing iOS applications
4
star
28

Realm-Codegen

Code Generation of Realm model files in Swift using Sourcery
Swift
2
star
29

OpenAPI-Project-Template

Template for OpenAPI specifications
Makefile
2
star
30

android-project-template

Kotlin
2
star
31

dev-academy-ios

Swift
2
star
32

f-academy-project-android

Kotlin
2
star
33

android-project-template-compose

Kotlin
1
star
34

brmo2023-kmm-talk

Code for the "KMM: Shared Navigation -- Finding The Sweet Spot" talk presented at BrMo2023 & Betsys Mobile dev meetup 2023
Kotlin
1
star
35

FTLogKit

Yet another logging framework for Apple platforms
Swift
1
star
36

ui-test-examples

xcode ui test examples
Swift
1
star
37

SwiftMonkeys

Monkeys for UI automated testing. Also known as UI/Application Exerciser Monkey.
Objective-C
1
star
38

TFSlideControl

Swift
1
star
39

.github

1
star
40

FCodeWars

1
star
41

FTTestingKit

Mockups and async extension to XCTestCase
Swift
1
star
42

FuturedKit

SwiftUI state management tools, resources and views used by Futured.
Swift
1
star
43

iOS-project-template

Template for creating iOS projects we use @futuredapp.
Ruby
1
star