Skip to content

Instantly share code, notes, and snippets.

@monyschuk
Created May 12, 2016 12:45
Show Gist options
  • Save monyschuk/9769838556874e01eb7686bc675b1e12 to your computer and use it in GitHub Desktop.
Save monyschuk/9769838556874e01eb7686bc675b1e12 to your computer and use it in GitHub Desktop.
MaterialIcons with NSAttributedString, NSImage support for Swift
// MaterialIcons for Cocoa
import Cocoa
import CoreText
public enum MaterialIcon: String {
case ThreeDRotation = "\u{e84d}"
case Accessibility = "\u{e84e}"
case AccountBalance = "\u{e84f}"
case AccountBalanceWallet = "\u{e850}"
case AccountBox = "\u{e851}"
case AccountCircle = "\u{e853}"
case AddShoppingCart = "\u{e854}"
case Alarm = "\u{e855}"
case AlarmAdd = "\u{e856}"
case AlarmOff = "\u{e857}"
case AlarmOn = "\u{e858}"
case Android = "\u{e859}"
case Announcement = "\u{e85a}"
case AspectRatio = "\u{e85b}"
case Assessment = "\u{e85c}"
case Assignment = "\u{e85d}"
case AssignmentInd = "\u{e85e}"
case AssignmentLate = "\u{e85f}"
case AssignmentReturn = "\u{e860}"
case AssignmentReturned = "\u{e861}"
case AssignmentTurnedIn = "\u{e862}"
case Autorenew = "\u{e863}"
case Backup = "\u{e864}"
case Book = "\u{e865}"
case Bookmark = "\u{e866}"
case BookmarkBorder = "\u{e867}"
case BugReport = "\u{e868}"
case Build = "\u{e869}"
case Cached = "\u{e86a}"
case CameraEnhance = "\u{e8fc}"
case CardGiftcard = "\u{e8f6}"
case CardMembership = "\u{e8f7}"
case CardTravel = "\u{e8f8}"
case ChangeHistory = "\u{e86b}"
case CheckCircle = "\u{e86c}"
case ChromeReaderMode = "\u{e86d}"
case Class = "\u{e86e}"
case Code = "\u{e86f}"
case CreditCard = "\u{e870}"
case Dashboard = "\u{e871}"
case Delete = "\u{e872}"
case Description = "\u{e873}"
case Dns = "\u{e875}"
case Done = "\u{e876}"
case DoneAll = "\u{e877}"
case Eject = "\u{e8fb}"
case Event = "\u{e878}"
case EventSeat = "\u{e903}"
case ExitToApp = "\u{e879}"
case Explore = "\u{e87a}"
case Extension = "\u{e87b}"
case Face = "\u{e87c}"
case Favorite = "\u{e87d}"
case FavoriteBorder = "\u{e87e}"
case Feedback = "\u{e87f}"
case FindInPage = "\u{e880}"
case FindReplace = "\u{e881}"
case FlightLand = "\u{e904}"
case FlightTakeoff = "\u{e905}"
case FlipToBack = "\u{e882}"
case FlipToFront = "\u{e883}"
case GetApp = "\u{e884}"
case Gif = "\u{e908}"
case Grade = "\u{e885}"
case GroupWork = "\u{e886}"
case Help = "\u{e887}"
case HelpOutline = "\u{e8fd}"
case HighlightOff = "\u{e888}"
case History = "\u{e889}"
case Home = "\u{e88a}"
case HourglassEmpty = "\u{e88b}"
case HourglassFull = "\u{e88c}"
case Http = "\u{e902}"
case Https = "\u{e88d}"
case Info = "\u{e88e}"
case InfoOutline = "\u{e88f}"
case Input = "\u{e890}"
case InvertColors = "\u{e891}"
case Label = "\u{e892}"
case LabelOutline = "\u{e893}"
case Language = "\u{e894}"
case Launch = "\u{e895}"
case List = "\u{e896}"
case Lock = "\u{e897}"
case LockOpen = "\u{e898}"
case LockOutline = "\u{e899}"
case Loyalty = "\u{e89a}"
case MarkunreadMailbox = "\u{e89b}"
case NoteAdd = "\u{e89c}"
case OfflinePin = "\u{e90a}"
case OpenInBrowser = "\u{e89d}"
case OpenInNew = "\u{e89e}"
case OpenWith = "\u{e89f}"
case Pageview = "\u{e8a0}"
case Payment = "\u{e8a1}"
case PermCameraMic = "\u{e8a2}"
case PermContactCalendar = "\u{e8a3}"
case PermDataSetting = "\u{e8a4}"
case PermDeviceInformation = "\u{e8a5}"
case PermIdentity = "\u{e8a6}"
case PermMedia = "\u{e8a7}"
case PermPhoneMsg = "\u{e8a8}"
case PermScanWifi = "\u{e8a9}"
case PictureInPicture = "\u{e8aa}"
case PlayForWork = "\u{e906}"
case Polymer = "\u{e8ab}"
case PowerSettingsNew = "\u{e8ac}"
case Print = "\u{e8ad}"
case QueryBuilder = "\u{e8ae}"
case QuestionAnswer = "\u{e8af}"
case Receipt = "\u{e8b0}"
case Redeem = "\u{e8b1}"
case Reorder = "\u{e8fe}"
case ReportProblem = "\u{e8b2}"
case Restore = "\u{e8b3}"
case Room = "\u{e8b4}"
case Schedule = "\u{e8b5}"
case Search = "\u{e8b6}"
case Settings = "\u{e8b8}"
case SettingsApplications = "\u{e8b9}"
case SettingsBackupRestore = "\u{e8ba}"
case SettingsBluetooth = "\u{e8bb}"
case SettingsBrightness = "\u{e8bd}"
case SettingsCell = "\u{e8bc}"
case SettingsEthernet = "\u{e8be}"
case SettingsInputAntenna = "\u{e8bf}"
case SettingsInputComponent = "\u{e8c0}"
case SettingsInputComposite = "\u{e8c1}"
case SettingsInputHdmi = "\u{e8c2}"
case SettingsInputSvideo = "\u{e8c3}"
case SettingsOverscan = "\u{e8c4}"
case SettingsPhone = "\u{e8c5}"
case SettingsPower = "\u{e8c6}"
case SettingsRemote = "\u{e8c7}"
case SettingsVoice = "\u{e8c8}"
case Shop = "\u{e8c9}"
case ShopTwo = "\u{e8ca}"
case ShoppingBasket = "\u{e8cb}"
case ShoppingCart = "\u{e8cc}"
case SpeakerNotes = "\u{e8cd}"
case Spellcheck = "\u{e8ce}"
case StarRate = "\u{e8cf}"
case Stars = "\u{e8d0}"
case Store = "\u{e8d1}"
case Subject = "\u{e8d2}"
case SupervisorAccount = "\u{e8d3}"
case SwapHoriz = "\u{e8d4}"
case SwapVert = "\u{e8d5}"
case SwapVerticalCircle = "\u{e8d6}"
case SystemUpdateAlt = "\u{e8d7}"
case Tab = "\u{e8d8}"
case TabUnselected = "\u{e8d9}"
case Theaters = "\u{e8da}"
case ThumbDown = "\u{e8db}"
case ThumbUp = "\u{e8dc}"
case ThumbsUpDown = "\u{e8dd}"
case Toc = "\u{e8de}"
case Today = "\u{e8df}"
case Toll = "\u{e8e0}"
case TrackChanges = "\u{e8e1}"
case Translate = "\u{e8e2}"
case TrendingDown = "\u{e8e3}"
case TrendingFlat = "\u{e8e4}"
case TrendingUp = "\u{e8e5}"
case TurnedIn = "\u{e8e6}"
case TurnedInNot = "\u{e8e7}"
case VerifiedUser = "\u{e8e8}"
case ViewAgenda = "\u{e8e9}"
case ViewArray = "\u{e8ea}"
case ViewCarousel = "\u{e8eb}"
case ViewColumn = "\u{e8ec}"
case ViewDay = "\u{e8ed}"
case ViewHeadline = "\u{e8ee}"
case ViewList = "\u{e8ef}"
case ViewModule = "\u{e8f0}"
case ViewQuilt = "\u{e8f1}"
case ViewStream = "\u{e8f2}"
case ViewWeek = "\u{e8f3}"
case Visibility = "\u{e8f4}"
case VisibilityOff = "\u{e8f5}"
case Work = "\u{e8f9}"
case YoutubeSearchedFor = "\u{e8fa}"
case ZoomIn = "\u{e8ff}"
case ZoomOut = "\u{e900}"
case AddAlert = "\u{e003}"
case Error = "\u{e000}"
case ErrorOutline = "\u{e001}"
case Warning = "\u{e002}"
case Airplay = "\u{e055}"
case Album = "\u{e019}"
case AvTimer = "\u{e01b}"
case ClosedCaption = "\u{e01c}"
case Equalizer = "\u{e01d}"
case Explicit = "\u{e01e}"
case FastForward = "\u{e01f}"
case FastRewind = "\u{e020}"
case Forward10 = "\u{e056}"
case Forward30 = "\u{e057}"
case Forward5 = "\u{e058}"
case Games = "\u{e021}"
case Hd = "\u{e052}"
case Hearing = "\u{e023}"
case HighQuality = "\u{e024}"
case LibraryAdd = "\u{e02e}"
case LibraryBooks = "\u{e02f}"
case LibraryMusic = "\u{e030}"
case Loop = "\u{e028}"
case Mic = "\u{e029}"
case MicNone = "\u{e02a}"
case MicOff = "\u{e02b}"
case Movie = "\u{e02c}"
case NewReleases = "\u{e031}"
case NotInterested = "\u{e033}"
case Pause = "\u{e034}"
case PauseCircleFilled = "\u{e035}"
case PauseCircleOutline = "\u{e036}"
case PlayArrow = "\u{e037}"
case PlayCircleFilled = "\u{e038}"
case PlayCircleOutline = "\u{e039}"
case PlaylistAdd = "\u{e03b}"
case Queue = "\u{e03c}"
case QueueMusic = "\u{e03d}"
case Radio = "\u{e03e}"
case RecentActors = "\u{e03f}"
case Repeat = "\u{e040}"
case RepeatOne = "\u{e041}"
case Replay = "\u{e042}"
case Replay10 = "\u{e059}"
case Replay30 = "\u{e05a}"
case Replay5 = "\u{e05b}"
case Shuffle = "\u{e043}"
case SkipNext = "\u{e044}"
case SkipPrevious = "\u{e045}"
case Snooze = "\u{e046}"
case SortByAlpha = "\u{e053}"
case Stop = "\u{e047}"
case Subtitles = "\u{e048}"
case SurroundSound = "\u{e049}"
case VideoLibrary = "\u{e04a}"
case Videocam = "\u{e04b}"
case VideocamOff = "\u{e04c}"
case VolumeDown = "\u{e04d}"
case VolumeMute = "\u{e04e}"
case VolumeOff = "\u{e04f}"
case VolumeUp = "\u{e050}"
case Web = "\u{e051}"
case Business = "\u{e0af}"
case Call = "\u{e0b0}"
case CallEnd = "\u{e0b1}"
case CallMade = "\u{e0b2}"
case CallMerge = "\u{e0b3}"
case CallMissed = "\u{e0b4}"
case CallReceived = "\u{e0b5}"
case CallSplit = "\u{e0b6}"
case Chat = "\u{e0b7}"
case ChatBubble = "\u{e0ca}"
case ChatBubbleOutline = "\u{e0cb}"
case ClearAll = "\u{e0b8}"
case Comment = "\u{e0b9}"
case ContactPhone = "\u{e0cf}"
case Contacts = "\u{e0ba}"
case DialerSip = "\u{e0bb}"
case Dialpad = "\u{e0bc}"
case Email = "\u{e0be}"
case Forum = "\u{e0bf}"
case ImportExport = "\u{e0c3}"
case InvertColorsOff = "\u{e0c4}"
case LiveHelp = "\u{e0c6}"
case LocationOff = "\u{e0c7}"
case LocationOn = "\u{e0c8}"
case Message = "\u{e0c9}"
case NoSim = "\u{e0cc}"
case Phone = "\u{e0cd}"
case PhonelinkErase = "\u{e0db}"
case PhonelinkLock = "\u{e0dc}"
case PhonelinkRing = "\u{e0dd}"
case PhonelinkSetup = "\u{e0de}"
case PortableWifiOff = "\u{e0ce}"
case PresentToAll = "\u{e0df}"
case RingVolume = "\u{e0d1}"
case SpeakerPhone = "\u{e0d2}"
case StayCurrentLandscape = "\u{e0d3}"
case StayCurrentPortrait = "\u{e0d4}"
case StayPrimaryLandscape = "\u{e0d5}"
case StayPrimaryPortrait = "\u{e0d6}"
case SwapCalls = "\u{e0d7}"
case Textsms = "\u{e0d8}"
case Voicemail = "\u{e0d9}"
case VpnKey = "\u{e0da}"
case Add = "\u{e145}"
case AddBox = "\u{e146}"
case AddCircle = "\u{e147}"
case AddCircleOutline = "\u{e148}"
case Archive = "\u{e149}"
case Backspace = "\u{e14a}"
case Block = "\u{e14b}"
case Clear = "\u{e14c}"
case ContentCopy = "\u{e14d}"
case ContentCut = "\u{e14e}"
case ContentPaste = "\u{e14f}"
case Create = "\u{e150}"
case Drafts = "\u{e151}"
case FilterList = "\u{e152}"
case Flag = "\u{e153}"
case FontDownload = "\u{e167}"
case Forward = "\u{e154}"
case Gesture = "\u{e155}"
case Inbox = "\u{e156}"
case Link = "\u{e157}"
case Mail = "\u{e158}"
case Markunread = "\u{e159}"
case Redo = "\u{e15a}"
case Remove = "\u{e15b}"
case RemoveCircle = "\u{e15c}"
case RemoveCircleOutline = "\u{e15d}"
case Reply = "\u{e15e}"
case ReplyAll = "\u{e15f}"
case Report = "\u{e160}"
case Save = "\u{e161}"
case SelectAll = "\u{e162}"
case Send = "\u{e163}"
case Sort = "\u{e164}"
case TextFormat = "\u{e165}"
case Undo = "\u{e166}"
case AccessAlarm = "\u{e190}"
case AccessAlarms = "\u{e191}"
case AccessTime = "\u{e192}"
case AddAlarm = "\u{e193}"
case AirplanemodeActive = "\u{e195}"
case AirplanemodeInactive = "\u{e194}"
case BatteryAlert = "\u{e19c}"
case BatteryChargingFull = "\u{e1a3}"
case BatteryFull = "\u{e1a4}"
case BatteryStd = "\u{e1a5}"
case BatteryUnknown = "\u{e1a6}"
case Bluetooth = "\u{e1a7}"
case BluetoothConnected = "\u{e1a8}"
case BluetoothDisabled = "\u{e1a9}"
case BluetoothSearching = "\u{e1aa}"
case BrightnessAuto = "\u{e1ab}"
case BrightnessHigh = "\u{e1ac}"
case BrightnessLow = "\u{e1ad}"
case BrightnessMedium = "\u{e1ae}"
case DataUsage = "\u{e1af}"
case DeveloperMode = "\u{e1b0}"
case Devices = "\u{e1b1}"
case Dvr = "\u{e1b2}"
case GpsFixed = "\u{e1b3}"
case GpsNotFixed = "\u{e1b4}"
case GpsOff = "\u{e1b5}"
case GraphicEq = "\u{e1b8}"
case LocationDisabled = "\u{e1b6}"
case LocationSearching = "\u{e1b7}"
case NetworkCell = "\u{e1b9}"
case NetworkWifi = "\u{e1ba}"
case Nfc = "\u{e1bb}"
case ScreenLockLandscape = "\u{e1be}"
case ScreenLockPortrait = "\u{e1bf}"
case ScreenLockRotation = "\u{e1c0}"
case ScreenRotation = "\u{e1c1}"
case SdStorage = "\u{e1c2}"
case SettingsSystemDaydream = "\u{e1c3}"
case SignalCellular4Bar = "\u{e1c8}"
case SignalCellularConnectedNoInternet4Bar = "\u{e1cd}"
case SignalCellularNoSim = "\u{e1ce}"
case SignalCellularNull = "\u{e1cf}"
case SignalCellularOff = "\u{e1d0}"
case SignalWifi4Bar = "\u{e1d8}"
case SignalWifi4BarLock = "\u{e1d9}"
case SignalWifiOff = "\u{e1da}"
case Storage = "\u{e1db}"
case Usb = "\u{e1e0}"
case Wallpaper = "\u{e1bc}"
case Widgets = "\u{e1bd}"
case WifiLock = "\u{e1e1}"
case WifiTethering = "\u{e1e2}"
case AttachFile = "\u{e226}"
case AttachMoney = "\u{e227}"
case BorderAll = "\u{e228}"
case BorderBottom = "\u{e229}"
case BorderClear = "\u{e22a}"
case BorderColor = "\u{e22b}"
case BorderHorizontal = "\u{e22c}"
case BorderInner = "\u{e22d}"
case BorderLeft = "\u{e22e}"
case BorderOuter = "\u{e22f}"
case BorderRight = "\u{e230}"
case BorderStyle = "\u{e231}"
case BorderTop = "\u{e232}"
case BorderVertical = "\u{e233}"
case FormatAlignCenter = "\u{e234}"
case FormatAlignJustify = "\u{e235}"
case FormatAlignLeft = "\u{e236}"
case FormatAlignRight = "\u{e237}"
case FormatBold = "\u{e238}"
case FormatClear = "\u{e239}"
case FormatColorFill = "\u{e23a}"
case FormatColorReset = "\u{e23b}"
case FormatColorText = "\u{e23c}"
case FormatIndentDecrease = "\u{e23d}"
case FormatIndentIncrease = "\u{e23e}"
case FormatItalic = "\u{e23f}"
case FormatLineSpacing = "\u{e240}"
case FormatListBulleted = "\u{e241}"
case FormatListNumbered = "\u{e242}"
case FormatPaint = "\u{e243}"
case FormatQuote = "\u{e244}"
case FormatSize = "\u{e245}"
case FormatStrikethrough = "\u{e246}"
case FormatTextdirectionLToR = "\u{e247}"
case FormatTextdirectionRToL = "\u{e248}"
case FormatUnderlined = "\u{e249}"
case Functions = "\u{e24a}"
case InsertChart = "\u{e24b}"
case InsertComment = "\u{e24c}"
case InsertDriveFile = "\u{e24d}"
case InsertEmoticon = "\u{e24e}"
case InsertInvitation = "\u{e24f}"
case InsertLink = "\u{e250}"
case InsertPhoto = "\u{e251}"
case MergeType = "\u{e252}"
case ModeComment = "\u{e253}"
case ModeEdit = "\u{e254}"
case MoneyOff = "\u{e25c}"
case Publish = "\u{e255}"
case SpaceBar = "\u{e256}"
case StrikethroughS = "\u{e257}"
case VerticalAlignBottom = "\u{e258}"
case VerticalAlignCenter = "\u{e259}"
case VerticalAlignTop = "\u{e25a}"
case WrapText = "\u{e25b}"
case Attachment = "\u{e2bc}"
case Cloud = "\u{e2bd}"
case CloudCircle = "\u{e2be}"
case CloudDone = "\u{e2bf}"
case CloudDownload = "\u{e2c0}"
case CloudOff = "\u{e2c1}"
case CloudQueue = "\u{e2c2}"
case CloudUpload = "\u{e2c3}"
case FileDownload = "\u{e2c4}"
case FileUpload = "\u{e2c6}"
case Folder = "\u{e2c7}"
case FolderOpen = "\u{e2c8}"
case FolderShared = "\u{e2c9}"
case Cast = "\u{e307}"
case CastConnected = "\u{e308}"
case Computer = "\u{e30a}"
case DesktopMac = "\u{e30b}"
case DesktopWindows = "\u{e30c}"
case DeveloperBoard = "\u{e30d}"
case DeviceHub = "\u{e335}"
case Dock = "\u{e30e}"
case Gamepad = "\u{e30f}"
case Headset = "\u{e310}"
case HeadsetMic = "\u{e311}"
case Keyboard = "\u{e312}"
case KeyboardArrowDown = "\u{e313}"
case KeyboardArrowLeft = "\u{e314}"
case KeyboardArrowRight = "\u{e315}"
case KeyboardArrowUp = "\u{e316}"
case KeyboardBackspace = "\u{e317}"
case KeyboardCapslock = "\u{e318}"
case KeyboardHide = "\u{e31a}"
case KeyboardReturn = "\u{e31b}"
case KeyboardTab = "\u{e31c}"
case KeyboardVoice = "\u{e31d}"
case Laptop = "\u{e31e}"
case LaptopChromebook = "\u{e31f}"
case LaptopMac = "\u{e320}"
case LaptopWindows = "\u{e321}"
case Memory = "\u{e322}"
case Mouse = "\u{e323}"
case PhoneAndroid = "\u{e324}"
case PhoneIphone = "\u{e325}"
case Phonelink = "\u{e326}"
case PhonelinkOff = "\u{e327}"
case PowerInput = "\u{e336}"
case Router = "\u{e328}"
case Scanner = "\u{e329}"
case Security = "\u{e32a}"
case SimCard = "\u{e32b}"
case Smartphone = "\u{e32c}"
case Speaker = "\u{e32d}"
case SpeakerGroup = "\u{e32e}"
case Tablet = "\u{e32f}"
case TabletAndroid = "\u{e330}"
case TabletMac = "\u{e331}"
case Toys = "\u{e332}"
case Tv = "\u{e333}"
case Watch = "\u{e334}"
case AddToPhotos = "\u{e39d}"
case Adjust = "\u{e39e}"
case Assistant = "\u{e39f}"
case AssistantPhoto = "\u{e3a0}"
case Audiotrack = "\u{e3a1}"
case BlurCircular = "\u{e3a2}"
case BlurLinear = "\u{e3a3}"
case BlurOff = "\u{e3a4}"
case BlurOn = "\u{e3a5}"
case Brightness1 = "\u{e3a6}"
case Brightness2 = "\u{e3a7}"
case Brightness3 = "\u{e3a8}"
case Brightness4 = "\u{e3a9}"
case Brightness5 = "\u{e3aa}"
case Brightness6 = "\u{e3ab}"
case Brightness7 = "\u{e3ac}"
case BrokenImage = "\u{e3ad}"
case Brush = "\u{e3ae}"
case Camera = "\u{e3af}"
case CameraAlt = "\u{e3b0}"
case CameraFront = "\u{e3b1}"
case CameraRear = "\u{e3b2}"
case CameraRoll = "\u{e3b3}"
case CenterFocusStrong = "\u{e3b4}"
case CenterFocusWeak = "\u{e3b5}"
case Collections = "\u{e3b6}"
case CollectionsBookmark = "\u{e431}"
case ColorLens = "\u{e3b7}"
case Colorize = "\u{e3b8}"
case Compare = "\u{e3b9}"
case ControlPoint = "\u{e3ba}"
case ControlPointDuplicate = "\u{e3bb}"
case Crop = "\u{e3be}"
case Crop169 = "\u{e3bc}"
case Crop32 = "\u{e3bd}"
case Crop54 = "\u{e3bf}"
case Crop75 = "\u{e3c0}"
case CropDin = "\u{e3c1}"
case CropFree = "\u{e3c2}"
case CropLandscape = "\u{e3c3}"
case CropOriginal = "\u{e3c4}"
case CropPortrait = "\u{e3c5}"
case CropSquare = "\u{e3c6}"
case Dehaze = "\u{e3c7}"
case Details = "\u{e3c8}"
case Edit = "\u{e3c9}"
case Exposure = "\u{e3ca}"
case ExposureNeg1 = "\u{e3cb}"
case ExposureNeg2 = "\u{e3cc}"
case ExposurePlus1 = "\u{e3cd}"
case ExposurePlus2 = "\u{e3ce}"
case ExposureZero = "\u{e3cf}"
case Filter = "\u{e3d3}"
case Filter1 = "\u{e3d0}"
case Filter2 = "\u{e3d1}"
case Filter3 = "\u{e3d2}"
case Filter4 = "\u{e3d4}"
case Filter5 = "\u{e3d5}"
case Filter6 = "\u{e3d6}"
case Filter7 = "\u{e3d7}"
case Filter8 = "\u{e3d8}"
case Filter9 = "\u{e3d9}"
case Filter9Plus = "\u{e3da}"
case FilterBAndW = "\u{e3db}"
case FilterCenterFocus = "\u{e3dc}"
case FilterDrama = "\u{e3dd}"
case FilterFrames = "\u{e3de}"
case FilterHdr = "\u{e3df}"
case FilterNone = "\u{e3e0}"
case FilterTiltShift = "\u{e3e2}"
case FilterVintage = "\u{e3e3}"
case Flare = "\u{e3e4}"
case FlashAuto = "\u{e3e5}"
case FlashOff = "\u{e3e6}"
case FlashOn = "\u{e3e7}"
case Flip = "\u{e3e8}"
case Gradient = "\u{e3e9}"
case Grain = "\u{e3ea}"
case GridOff = "\u{e3eb}"
case GridOn = "\u{e3ec}"
case HdrOff = "\u{e3ed}"
case HdrOn = "\u{e3ee}"
case HdrStrong = "\u{e3f1}"
case HdrWeak = "\u{e3f2}"
case Healing = "\u{e3f3}"
case Image = "\u{e3f4}"
case ImageAspectRatio = "\u{e3f5}"
case Iso = "\u{e3f6}"
case Landscape = "\u{e3f7}"
case LeakAdd = "\u{e3f8}"
case LeakRemove = "\u{e3f9}"
case Lens = "\u{e3fa}"
case Looks = "\u{e3fc}"
case Looks3 = "\u{e3fb}"
case Looks4 = "\u{e3fd}"
case Looks5 = "\u{e3fe}"
case Looks6 = "\u{e3ff}"
case LooksOne = "\u{e400}"
case LooksTwo = "\u{e401}"
case Loupe = "\u{e402}"
case MonochromePhotos = "\u{e403}"
case MovieCreation = "\u{e404}"
case MusicNote = "\u{e405}"
case Nature = "\u{e406}"
case NaturePeople = "\u{e407}"
case NavigateBefore = "\u{e408}"
case NavigateNext = "\u{e409}"
case Palette = "\u{e40a}"
case Panorama = "\u{e40b}"
case PanoramaFishEye = "\u{e40c}"
case PanoramaHorizontal = "\u{e40d}"
case PanoramaVertical = "\u{e40e}"
case PanoramaWideAngle = "\u{e40f}"
case Photo = "\u{e410}"
case PhotoAlbum = "\u{e411}"
case PhotoCamera = "\u{e412}"
case PhotoLibrary = "\u{e413}"
case PhotoSizeSelectActual = "\u{e432}"
case PhotoSizeSelectLarge = "\u{e433}"
case PhotoSizeSelectSmall = "\u{e434}"
case PictureAsPdf = "\u{e415}"
case Portrait = "\u{e416}"
case RemoveRedEye = "\u{e417}"
case Rotate90DegreesCcw = "\u{e418}"
case RotateLeft = "\u{e419}"
case RotateRight = "\u{e41a}"
case Slideshow = "\u{e41b}"
case Straighten = "\u{e41c}"
case Style = "\u{e41d}"
case SwitchCamera = "\u{e41e}"
case SwitchVideo = "\u{e41f}"
case TagFaces = "\u{e420}"
case Texture = "\u{e421}"
case Timelapse = "\u{e422}"
case Timer = "\u{e425}"
case Timer10 = "\u{e423}"
case Timer3 = "\u{e424}"
case TimerOff = "\u{e426}"
case Tonality = "\u{e427}"
case Transform = "\u{e428}"
case Tune = "\u{e429}"
case ViewComfy = "\u{e42a}"
case ViewCompact = "\u{e42b}"
case Vignette = "\u{e435}"
case WbAuto = "\u{e42c}"
case WbCloudy = "\u{e42d}"
case WbIncandescent = "\u{e42e}"
case WbIridescent = "\u{e436}"
case WbSunny = "\u{e430}"
case Beenhere = "\u{e52d}"
case Directions = "\u{e52e}"
case DirectionsBike = "\u{e52f}"
case DirectionsBoat = "\u{e532}"
case DirectionsBus = "\u{e530}"
case DirectionsCar = "\u{e531}"
case DirectionsRailway = "\u{e534}"
case DirectionsRun = "\u{e566}"
case DirectionsSubway = "\u{e533}"
case DirectionsTransit = "\u{e535}"
case DirectionsWalk = "\u{e536}"
case Flight = "\u{e539}"
case Hotel = "\u{e53a}"
case Layers = "\u{e53b}"
case LayersClear = "\u{e53c}"
case LocalActivity = "\u{e53f}"
case LocalAirport = "\u{e53d}"
case LocalAtm = "\u{e53e}"
case LocalBar = "\u{e540}"
case LocalCafe = "\u{e541}"
case LocalCarWash = "\u{e542}"
case LocalConvenienceStore = "\u{e543}"
case LocalDining = "\u{e556}"
case LocalDrink = "\u{e544}"
case LocalFlorist = "\u{e545}"
case LocalGasStation = "\u{e546}"
case LocalGroceryStore = "\u{e547}"
case LocalHospital = "\u{e548}"
case LocalHotel = "\u{e549}"
case LocalLaundryService = "\u{e54a}"
case LocalLibrary = "\u{e54b}"
case LocalMall = "\u{e54c}"
case LocalMovies = "\u{e54d}"
case LocalOffer = "\u{e54e}"
case LocalParking = "\u{e54f}"
case LocalPharmacy = "\u{e550}"
case LocalPhone = "\u{e551}"
case LocalPizza = "\u{e552}"
case LocalPlay = "\u{e553}"
case LocalPostOffice = "\u{e554}"
case LocalPrintshop = "\u{e555}"
case LocalSee = "\u{e557}"
case LocalShipping = "\u{e558}"
case LocalTaxi = "\u{e559}"
case Map = "\u{e55b}"
case MyLocation = "\u{e55c}"
case Navigation = "\u{e55d}"
case PersonPin = "\u{e55a}"
case PinDrop = "\u{e55e}"
case Place = "\u{e55f}"
case RateReview = "\u{e560}"
case RestaurantMenu = "\u{e561}"
case Satellite = "\u{e562}"
case StoreMallDirectory = "\u{e563}"
case Terrain = "\u{e564}"
case Traffic = "\u{e565}"
case Apps = "\u{e5c3}"
case ArrowBack = "\u{e5c4}"
case ArrowDropDown = "\u{e5c5}"
case ArrowDropDownCircle = "\u{e5c6}"
case ArrowDropUp = "\u{e5c7}"
case ArrowForward = "\u{e5c8}"
case Cancel = "\u{e5c9}"
case Check = "\u{e5ca}"
case ChevronLeft = "\u{e5cb}"
case ChevronRight = "\u{e5cc}"
case Close = "\u{e5cd}"
case ExpandLess = "\u{e5ce}"
case ExpandMore = "\u{e5cf}"
case Fullscreen = "\u{e5d0}"
case FullscreenExit = "\u{e5d1}"
case Menu = "\u{e5d2}"
case MoreHoriz = "\u{e5d3}"
case MoreVert = "\u{e5d4}"
case Refresh = "\u{e5d5}"
case Adb = "\u{e60e}"
case AirlineSeatFlat = "\u{e630}"
case AirlineSeatFlatAngled = "\u{e631}"
case AirlineSeatIndividualSuite = "\u{e632}"
case AirlineSeatLegroomExtra = "\u{e633}"
case AirlineSeatLegroomNormal = "\u{e634}"
case AirlineSeatLegroomReduced = "\u{e635}"
case AirlineSeatReclineExtra = "\u{e636}"
case AirlineSeatReclineNormal = "\u{e637}"
case BluetoothAudio = "\u{e60f}"
case ConfirmationNumber = "\u{e638}"
case DiscFull = "\u{e610}"
case DoNotDisturb = "\u{e612}"
case DoNotDisturbAlt = "\u{e611}"
case DriveEta = "\u{e613}"
case EventAvailable = "\u{e614}"
case EventBusy = "\u{e615}"
case EventNote = "\u{e616}"
case FolderSpecial = "\u{e617}"
case LiveTv = "\u{e639}"
case Mms = "\u{e618}"
case More = "\u{e619}"
case NetworkLocked = "\u{e61a}"
case OndemandVideo = "\u{e63a}"
case PersonalVideo = "\u{e63b}"
case PhoneBluetoothSpeaker = "\u{e61b}"
case PhoneForwarded = "\u{e61c}"
case PhoneInTalk = "\u{e61d}"
case PhoneLocked = "\u{e61e}"
case PhoneMissed = "\u{e61f}"
case PhonePaused = "\u{e620}"
case Power = "\u{e63c}"
case SdCard = "\u{e623}"
case SimCardAlert = "\u{e624}"
case Sms = "\u{e625}"
case SmsFailed = "\u{e626}"
case Sync = "\u{e627}"
case SyncDisabled = "\u{e628}"
case SyncProblem = "\u{e629}"
case SystemUpdate = "\u{e62a}"
case TapAndPlay = "\u{e62b}"
case TimeToLeave = "\u{e62c}"
case Vibration = "\u{e62d}"
case VoiceChat = "\u{e62e}"
case VpnLock = "\u{e62f}"
case Wc = "\u{e63d}"
case Wifi = "\u{e63e}"
case Cake = "\u{e7e9}"
case Domain = "\u{e7ee}"
case Group = "\u{e7ef}"
case GroupAdd = "\u{e7f0}"
case LocationCity = "\u{e7f1}"
case Mood = "\u{e7f2}"
case MoodBad = "\u{e7f3}"
case Notifications = "\u{e7f4}"
case NotificationsActive = "\u{e7f7}"
case NotificationsNone = "\u{e7f5}"
case NotificationsOff = "\u{e7f6}"
case NotificationsPaused = "\u{e7f8}"
case Pages = "\u{e7f9}"
case PartyMode = "\u{e7fa}"
case People = "\u{e7fb}"
case PeopleOutline = "\u{e7fc}"
case Person = "\u{e7fd}"
case PersonAdd = "\u{e7fe}"
case PersonOutline = "\u{e7ff}"
case PlusOne = "\u{e800}"
case Poll = "\u{e801}"
case Public = "\u{e80b}"
case School = "\u{e80c}"
case Share = "\u{e80d}"
case Whatshot = "\u{e80e}"
case CheckBox = "\u{e834}"
case CheckBoxOutlineBlank = "\u{e835}"
case IndeterminateCheckBox = "\u{e909}"
case RadioButtonChecked = "\u{e837}"
case RadioButtonUnchecked = "\u{e836}"
case Star = "\u{e838}"
case StarBorder = "\u{e83a}"
case StarHalf = "\u{e839}"
public func image(pointSize: CGFloat) -> NSImage {
MaterialIconLoader.loadIfRequired()
return NSImage(icon: self, pointSize: pointSize)
}
public func attributedString(pointSize: CGFloat) -> NSAttributedString {
MaterialIconLoader.loadIfRequired()
let font = NSFont(name: "MaterialIcons-Regular", size: pointSize)!
return NSAttributedString(string: self.rawValue, attributes: [NSFontAttributeName: font])
}
}
// NOTE: NSBundle(forClass:) requires ObjC
private final class MaterialIconLoader: NSObject {
private static func loadIfRequired() {
dispatch_once(&MaterialIconLoader.once) {
guard let fontURL = NSBundle(forClass: MaterialIconLoader.self).URLForResource("MaterialIcons-Regular", withExtension: "ttf") else {
fatalError("Unable to load MaterialIcons-Regular font")
}
CTFontManagerRegisterFontsForURL(fontURL, .Process, nil)
}
}
private static var once: dispatch_once_t = 0
}
private extension NSImage {
private convenience init(icon: MaterialIcon, pointSize: CGFloat) {
self.init(size: CGSize(width: pointSize, height: pointSize), flipped: false) { rect in
guard let ctx = NSGraphicsContext.currentContext()?.CGContext else { return false }
let attr = String(kCTFontAttributeName)
let font = CTFontCreateWithName("MaterialIcons-Regular", rect.width, nil)
guard let str = CFAttributedStringCreate(nil, icon.rawValue, [attr: font]) else { return false }
let framesetter = CTFramesetterCreateWithAttributedString(str)
let frameSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetter, CFRange(), nil, CGRectInfinite.size, nil)
let framePath = CGPathCreateWithRect(CGRect(origin: CGPoint.zero, size: frameSize), nil)
let frame = CTFramesetterCreateFrame(framesetter, CFRange(), framePath, nil)
let lines = (CTFrameGetLines(frame) as [AnyObject]) as! Array<CTLine>
CTLineDraw(lines[0], ctx)
return true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment