All Projects → omidgolparvar → Persianswift

omidgolparvar / Persianswift

Licence: other
😋یه سری ابزار آماده کردیم، برای راحتی کار با زبان پارسی توی زبان برنامه‌نویسی سوییفت

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Persianswift

Rainbowbar
Progress bar with wild animation for notched status bar
Stars: ✭ 34 (-20.93%)
Mutual labels:  cocoapods
Grview
UIView and other UIKit elements with a gradient and other attributes for IOS
Stars: ✭ 39 (-9.3%)
Mutual labels:  cocoapods
Cocoapods Binary
integrate pods in form of prebuilt frameworks conveniently, reducing compile time
Stars: ✭ 1,004 (+2234.88%)
Mutual labels:  cocoapods
Scenekit Bezier Animations
Create animations over Bezier curves of any number of points
Stars: ✭ 35 (-18.6%)
Mutual labels:  cocoapods
Ftpopovermenu
FTPopOverMenu is a pop over menu for iOS which is maybe the easiest one to use. Supports both portrait and landscape. It can show from any UIView, any UIBarButtonItem and any CGRect.
Stars: ✭ 988 (+2197.67%)
Mutual labels:  cocoapods
Gaugekit
Kit for building custom gauges + easy reproducible Apple's style ring gauges.
Stars: ✭ 997 (+2218.6%)
Mutual labels:  cocoapods
Motion Animator Objc
A Motion Animator creates performant, interruptible iOS animations from motion specs.
Stars: ✭ 33 (-23.26%)
Mutual labels:  cocoapods
Wstagsfield
An iOS text field that represents tags, hashtags, tokens in general.
Stars: ✭ 1,013 (+2255.81%)
Mutual labels:  cocoapods
Swiftysound
SwiftySound is a simple library that lets you play sounds with a single line of code.
Stars: ✭ 995 (+2213.95%)
Mutual labels:  cocoapods
Istimeline
Simple timeline view written in Swift 3
Stars: ✭ 1,005 (+2237.21%)
Mutual labels:  cocoapods
Mbprogresshud Bwmextension
Nihility-Ming to MBProgressHUD extension, easy to use.
Stars: ✭ 35 (-18.6%)
Mutual labels:  cocoapods
Tangramkit
TangramKit is a powerful iOS UI framework implemented by Swift. It integrates the functions with Android layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,LayoutSizeClass to build your App 自动布局 UIView UITableView UICollectionView
Stars: ✭ 984 (+2188.37%)
Mutual labels:  cocoapods
Fontblaster
Programmatically load custom fonts into your iOS and tvOS app.
Stars: ✭ 1,000 (+2225.58%)
Mutual labels:  cocoapods
Mcplayerkit
MCPlayerKit is iOS Player, PlayerCoreType: AVPlayer can use play some video, IJKPlayer type can play video, Live ...
Stars: ✭ 34 (-20.93%)
Mutual labels:  cocoapods
Fugen
Command line tool for exporting resources and generating code from your Figma files
Stars: ✭ 41 (-4.65%)
Mutual labels:  cocoapods
Aaviewanimator
AAViewAnimator is a set of animations designed for UIView, UIButton, UIImageView with options in iOS, written in Swift.
Stars: ✭ 33 (-23.26%)
Mutual labels:  cocoapods
Aerogear Ios Http
Lightweight lib around NSURLSession to ease HTTP calls
Stars: ✭ 39 (-9.3%)
Mutual labels:  cocoapods
Elliotable
'Elliotable' is an iOS-based timetable library. It can beautifully represent timetable information.
Stars: ✭ 42 (-2.33%)
Mutual labels:  cocoapods
Dknetworking
基于 AFNetworking + YYCache 的二次封装,支持缓存策略的网络请求框架
Stars: ✭ 41 (-4.65%)
Mutual labels:  cocoapods
Sketchkit
A lightweight auto-layout DSL library for iOS & tvOS.
Stars: ✭ 40 (-6.98%)
Mutual labels:  cocoapods

CocoaPods Compatible Platform

پارسی‌سوییفت

کتابخانه PersianSwift یک کتابخانه نوشته شده برای زبان برنامه‌نویسی Swift هستش که استفاده از این زبان برنامه‌نویسی رو برای زبان فارسی راحت‌تر و شیرین‌تر می‌کنه.

برای راحتی بیشتر موقع استفاده، بیشتر امکانات این کتابخونه از طریق Extensionهای تعریف شده برای انواع داده در Swift در دسترس هست.

مثلا با استفاده از ابزار زیر، مقدار عددی 12345 به مقدار متنی متناظر باهاش و همراه با اعداد فارسی در دسترس هست:

let int = 12345
let persianString = int.ps.stringWithPersianDigits // ۱۲۳۴۵

نحوه نصب

با استفاده از CocoaPod خیلی راحت می‌تونین این کتابخونه رو به پروژه خودتون اضافه‌اش کنین.

pod 'PersianSwift', '~> 1.5' // Swift 3.0
pod 'PersianSwift', '~> 1.7' // Swift 4.0

بعد از نصب می‌تونین هرجایی که خواستین اون رو `import` کنین و از امکاناتش استفاده کنین.

import PersianSwift

در ادامه توضیحات مفصل قسمت‌های پیاده‌سازی شده رو نشون میدیم.


استفاده از دستورات آماده شده

متون یا همون String

  • چک کردن اینکه متن مورد نظر شماره تلفن موبایل باشه
String.ps.isPersianPhoneNumber -> Bool

  • تبدیل شده متن موجود، بهمراه تبدیل اعداد از به فارسی و یا لاتین
String.ps.withPersianDigits -> String
String.ps.withEasternDigits -> String

String.ps.toPersianDigits() -> Void
String.ps.toEnglishDigits() -> Void

  • تبدیل کاراکترهای خاص در متن فارسی (حروف ک عربی و ی عربی)
String.ps.withFixedPersianCharacters -> String
String.ps.fixPersianCharacters() -> Void

  • تبدیل شده متن موجود، بهمراه ظاهر قیمت

    اگه متن ما ساختار عددی مثل "12345" نداشته باشه، خروجی nil میشه.

String.ps.withIranRialStyle -> String?
String.ps.withIranTomanStyle -> String?
String.ps.withCurrencyStyle -> String?

  • تبدیل متن با ساختار تاریخ، به تاریخ شمسی متناظر با اون

    اگه متن ما ساختار تاریخ مثل "2017-06-03 17:23:41" رو نداشته باشه، خروجی `nil` میشه. البته فرمت ورودی رو میتونین موقع استفاده از این متد تنظیم کنین.

String.ps.asPersianDate(fromGregorianFormat: String) -> String?

اعداد مثل Int Double Float

برای این نوع داده‌ها، اول یه protocol به اسم Numeric تعریف شده و بعد نوع‌های Int, Double, Float این پروتکل رو استفاده کردن.

public protocol Numeric {}

extension Int    : Numeric {}
extension Double : Numeric {}
extension Float  : Numeric {}

بعد به اون پروتکل تعریف شده، موارد زیر اضافه شدن.

  • دریافت عدد بصورت متن
Numeric.ps.string -> String

  • دریافت عدد بصورت متن بهمراه اعداد فارسی
Numeric.ps.stringWithPersianDigits -> String

  • دریافت عدد بصورت متن و با ظاهر قیمت
Numeric.ps.stringWithCurrencyStyle -> String

موارد مربوط به تاریخ یا همون Date

با استفاده از موارد آماده شده، میتونین خیلی راحت یه تاریخ رو به شمسی تبدیل کنین. به عنوان مثال با استفاده از `timeinterval` دریافتی از وب‌سرویس، یه تاریخ بسازین. و بعد خیلی راحت اون رو به تاریخ شمسی تبدیل کنین.

نام موارد آماده شده و نمونه خروجی‌شون توی مثال زیر آورده شده:

let date = Date(timeIntervalSince1970: TimeInterval(exactly: 629152200)!)
_ = date.ps.asPersianDate // شنبه ۱۸ آذر ۱۳۶۸
_ = date.ps.asFullPersianDateTime // شنبه ۱۸ آذر ماه ۱۳۶۸ ساعت ۱۲:۰۰:۰۰ قبل از ظهر

آرایه‌ها

آرایه‌های متنی یا همون [String]

  • به ترتیب کردن آرایه‌ای از Stringها و دریافت خروجی

    این دستور روی آرایه‌ای از String اعمال میشه و اون رو بطور صعودی به ترتیب میکنه و بعنوان خروجی برمیگردونه.

[String].ps.sortedPersianStrings

  • به ترتیب کردن درجای آرایه‌ای از Stringها

    این دستور هم روی آرایه‌ای از String اعمال میشه و خود اون آرایه رو درجا به ترتیب میکنه. موقع استفاده از این دستور میتونین صعودی یا نزولی بودن ترتیب رو انتخاب کنین.

[String].ps.sortPersianStrings(desc: Bool)

همکاری

هرگونه همکاری و همفکری به شدت و با آغوش باز پذیرفته میشه. پس بیاین همدیگه رو در آغوش بگیریم!!! 😆😂😋

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].