All Projects → hemantasapkota → OpenSansSwift

hemantasapkota / OpenSansSwift

Licence: MIT license
Easily use the OpenSans font in Swift

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to OpenSansSwift

Punic
Clean room reimplementation of Carthage tool
Stars: ✭ 236 (+461.9%)
Mutual labels:  carthage
Localize
Localize is a framework writed in swift to localize your projects easier improves i18n, including storyboards and strings.
Stars: ✭ 253 (+502.38%)
Mutual labels:  carthage
DragDropUI
A set of iOS UI components which have drag & drop capability.
Stars: ✭ 30 (-28.57%)
Mutual labels:  carthage
Peek
All new design. Inspect your iOS application at runtime.
Stars: ✭ 2,594 (+6076.19%)
Mutual labels:  carthage
Wechatkit
一款快速实现微信第三方登录的框架(Swift版) SDK 1.8.5
Stars: ✭ 249 (+492.86%)
Mutual labels:  carthage
iOSProjects
It's project that contains different applications developed with Swift 5.7 👨‍💻👩🏼‍💻🧑🏿‍💻
Stars: ✭ 122 (+190.48%)
Mutual labels:  carthage
Swiftpagemenu
Customizable Page Tab Menu Controller 👍
Stars: ✭ 233 (+454.76%)
Mutual labels:  carthage
OrangeLabel
OrangeLabel is extensions of UILabel linkable, available line background and placeholder text
Stars: ✭ 19 (-54.76%)
Mutual labels:  carthage
Simplecheckbox
A simple Checkbox
Stars: ✭ 253 (+502.38%)
Mutual labels:  carthage
ASToast
A Swift extension for using Android style Toast notifications.
Stars: ✭ 34 (-19.05%)
Mutual labels:  carthage
Sensor Visualizer Kit
Visualize iOS sensors for live presentations, iOS AppStore demos, Apple Store prototypes, design reviews.
Stars: ✭ 242 (+476.19%)
Mutual labels:  carthage
Harpy
Harpy checks a user's currently installed version of your iOS app against the version that is currently available in the App Store. If a new version is available, an alert can be presented to the user informing them of the newer version, and giving them the option to update the application.
Stars: ✭ 2,619 (+6135.71%)
Mutual labels:  carthage
BuckoNetworking
iOS Protocol-Oriented Networking in Swift
Stars: ✭ 18 (-57.14%)
Mutual labels:  carthage
Photoslider
PhotoSlider is a simple photo slider and can delete slider with swiping.
Stars: ✭ 237 (+464.29%)
Mutual labels:  carthage
Validated
A rule-based validation framework
Stars: ✭ 31 (-26.19%)
Mutual labels:  carthage
Loolocator
A simple iOS app that fetches the crowd-sourced data from OpenStreetMaps, and shows toilets within walking distance.
Stars: ✭ 234 (+457.14%)
Mutual labels:  carthage
Colorizeswift
Terminal string styling for Swift.
Stars: ✭ 253 (+502.38%)
Mutual labels:  carthage
VGSegment
A segment menu with line animation
Stars: ✭ 19 (-54.76%)
Mutual labels:  carthage
atinternet-apple-sdk
AT Internet mobile analytics solution for Apple devices
Stars: ✭ 25 (-40.48%)
Mutual labels:  carthage
Go-Flashcards
Go Flashcards for iOS and WatchOS - Official repository
Stars: ✭ 60 (+42.86%)
Mutual labels:  carthage

Carthage compatible

OpenSansSwift

Easily use the OpenSans font in Swift.

Screenshot

Why use OpenSansSwift frameworks ?

The usual process of embedding any custom fonts in your IOS applications has a few steps:

  1. Copy all your font resources to your project
  2. Make sure they're copied to the bundle
  3. Add UIAppFonts key to info.plist.
  4. Painstakingly add all the font names with the right extension
  5. Find out the font family and font names programatically
  6. Use the fonts

For the OpenSans font, this framework does all that for you. All you have to do is link the compiled framework.

How to Install - Carthage

If you dont' already have Carthage, Install it with:

$ brew update
$ brew install carthage

Add github "hemantasapkota/OpenSansSwift" to your Cartfile.

Execute carthage install

Swift 3

Add github "hemantasapkota/OpenSansSwift" "swift3" to your Cartfile.

Execute carthage install

How to Install - Manual

Clone the repo and add OpenSansSwift.xcodeproj to you project. Link OpenSansSwift.framework to your project.

OpenSans Font Methods

Based on OpenSans v2.0, OpenSansSwift registers the following methods:

    openSansFontOfSize(size: Float) -> UIFont!
    openSansBoldFontOfSize(size: Float) -> UIFont!
    openSansBoldItalicFontOfSize(size: Float) -> UIFont!
    openSansExtraBoldFontOfSize(size: Float) -> UIFont!
    openSansExtraBoldItalicFontOfSize(size: Float) -> UIFont!
    openSansItalicFontOfSize(size: Float) -> UIFont!
    openSansLightFontOfSize(size: Float) -> UIFont!
    openSansLightItalicFontOfSize(size: Float) -> UIFont!
    openSansSemiboldFontOfSize(size: Float) -> UIFont!
    openSansSemiboldItalicFontOfSize(size: Float) -> UIFont!

Retina Scale Factor

Set OpenSans.retinaScaleFactor to scale out font sizes for the iPad. Default is 2.

Usage - Programmatically

See Example for more details.

import UIKit
import OpenSansSwift

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()    
        
        //Register Open Sans fonts. Register only once.
        OpenSans.registerFonts()
        
        // Set the scale for iPad. Default is 2.
        OpenSans.retinaScaleFactor = 1.5
        
        // Create a label
        let lbl1 = UILabel(frame: CGRectMake(x, y, size.width, size.height))
        
        lbl1.font = UIFont.openSansFontOfSize(30)
        
        lbl1.text = "This is OpenSans-Regular"
        self.view.addSubView(lbl1)
    }
}

Usage - Storyboard

XCode automatically detects the fonts present in the bundle, so you don't have to perform any registration for use in Storyboards.

Screenshot

Usage - With NSAttributedString

For use with NSAttributedString, Use the following strings: OpenSans, OpenSans-Bold, OpenSans-Italic

let regularAttribute = [NSFontAttributeName: UIFont(name: "OpenSans", size: 12)!]
let boldAttribute = [NSFontAttributeName: UIFont(name: "OpenSans-Bold", size: 12)!]
let italicAttribute = [NSFontAttributeName: UIFont(name: "OpenSans-Italic", size: 12)!]

Licence

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].