text stringlengths 9 39.2M | dir stringlengths 26 295 | lang stringclasses 185
values | created_date timestamp[us] | updated_date timestamp[us] | repo_name stringlengths 1 97 | repo_full_name stringlengths 7 106 | star int64 1k 183k | len_tokens int64 1 13.8M |
|---|---|---|---|---|---|---|---|---|
```swift
import UIKit
import Social
typealias CompletionBlock = () -> Void
/// Main VC for Simplenote's Share Extension
///
class ShareViewController: UIViewController {
/// This completion handler closure is executed when this VC is dismissed.
///
@objc var dismissalCompletionBlock: CompletionBlock?
... | /content/code_sandbox/SimplenoteShare/ViewControllers/ShareViewController.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 1,158 |
```swift
import UIKit
class SharePresentationController: UIViewController {
private let extensionTransitioningManager: ExtensionTransitioningManager = {
let manager = ExtensionTransitioningManager()
manager.presentDirection = .bottom
manager.dismissDirection = .bottom
return manage... | /content/code_sandbox/SimplenoteShare/ViewControllers/SharePresentationController.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 399 |
```swift
import UIKit
/// Allows certain presented view controllers to request themselves to be
/// presented at full size instead of inset within the container.
///
protocol ExtensionPresentationTarget {
var shouldFillContentContainer: Bool { get }
}
final class ExtensionPresentationController: UIPresentationCon... | /content/code_sandbox/SimplenoteShare/Presentation/ExtensionPresentationController.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 1,383 |
```swift
import UIKit
final class ExtensionTransitioningManager: NSObject {
var presentDirection = Direction.bottom
var dismissDirection = Direction.bottom
}
// MARK: - UIViewControllerTransitioningDelegate Conformance
//
extension ExtensionTransitioningManager: UIViewControllerTransitioningDelegate {
fu... | /content/code_sandbox/SimplenoteShare/Presentation/ExtensionTransitioningManager.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 202 |
```swift
import UIKit
/// Direction to transition from/to.
///
/// - left: Enter/leave screen via the left edge.
/// - top: Enter/leave screen via the top edge.
/// - right: Enter/leave screen via the left edge.
/// - bottom: Enter/leave screen via the bottom edge.
///
enum Direction {
case left
case top
c... | /content/code_sandbox/SimplenoteShare/Presentation/ExtensionPresentationAnimator.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 476 |
```objective-c
//
// TextBundle.h
// TextBundle-Mac
//
// Created by Matteo Rattotti on 22/02/2019.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
extern NSString * const kUTTypeMarkdown;
extern NSString * const kUTTypeTextBundle;
extern NSString * const TextBundleErrorDomain;
typedef NS_ENUM(NSIn... | /content/code_sandbox/SimplenoteShare/Tools/TextBundleWrapper.h | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 1,022 |
```objective-c
//
// TextBundle.m
// TextBundle-Mac
//
// Created by Matteo Rattotti on 22/02/2019.
//
#import "TextBundleWrapper.h"
#import <CoreServices/CoreServices.h>
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
// Filenames constants
NSString * const kTextBundleInfoFileName = @"info.json";
NSStri... | /content/code_sandbox/SimplenoteShare/Tools/TextBundleWrapper.m | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 2,101 |
```swift
import Foundation
// MARK: - NSExtensionContext's Simplenote Methods
//
extension NSExtensionContext {
/// Returns the AttributedContentText stored in the (first) ExtensionItem
///
var attributedContentText: NSAttributedString? {
guard let item = inputItems.first as? NSExtensionItem else ... | /content/code_sandbox/SimplenoteShare/Extensions/NSExtensionContext+Simplenote.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 258 |
```swift
import Foundation
/// Encapsulates NSURLSessionConfiguration Helpers
///
extension URLSessionConfiguration {
/// Returns a new Background Session Configuration, with a random identifier.
///
class func backgroundSessionConfigurationWithRandomizedIdentifier() -> URLSessionConfiguration {
l... | /content/code_sandbox/SimplenoteShare/Extensions/NSURLSessionConfiguration+Extensions.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 94 |
```swift
import Foundation
import UIKit
// MARK: - Simplenote's Theme
//
@objc
class SPUserInterface: NSObject {
/// Ladies and gentlemen, this is a singleton.
///
@objc
static let shared = SPUserInterface()
/// Indicates if the User Interface is in Dark Mode
///
@objc
static var isDa... | /content/code_sandbox/SimplenoteShare/Themes/SPUserInterface.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 95 |
```swift
import Foundation
import MobileCoreServices
import UniformTypeIdentifiers
// MARK: - PlainTextExtractor
//
struct PlainTextExtractor: Extractor {
/// Accepted File Extension
///
let acceptedType = UTType.plainText.identifier
/// Indicates if a given Extension Context can be handled by the Ex... | /content/code_sandbox/SimplenoteShare/Extractors/PlainTextExtractor.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 231 |
```swift
import Foundation
import MobileCoreServices
import ZIPFoundation
import UniformTypeIdentifiers
// MARK: - URLExtractor
//
struct URLExtractor: Extractor {
/// Accepted File Extension
///
let acceptedType = UTType.url.identifier
/// Indicates if a given Extension Context can be handled by the... | /content/code_sandbox/SimplenoteShare/Extractors/URLExtractor.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 913 |
```swift
import Foundation
// MARK: - Extractors: Convenience Struct that manages access to all of the known Extractors.
//
struct Extractors {
/// All of the known Extractors
///
private static let extractors: [Extractor] = [
URLExtractor(),
PlainTextExtractor()
]
/// Returns the... | /content/code_sandbox/SimplenoteShare/Extractors/Extractors.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 120 |
```swift
import Foundation
// MARK: - Extractor
//
protocol Extractor {
/// Accepted File Extension
///
var acceptedType: String { get }
/// Indicates if a given Extension Context can be handled by the Extractor
///
func canHandle(context: NSExtensionContext) -> Bool
/// Extracts a Note ... | /content/code_sandbox/SimplenoteShare/Extractors/Extractor.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 106 |
```objective-c
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "Foundation/Foundation.h"
#import "SPConstants.h"
``` | /content/code_sandbox/SimplenoteIntents/Simplenote-Intents-Bridging-Header.h | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 36 |
```swift
//
// IntentsError.swift
// SimplenoteIntents
//
// Created by Charlie Scheer on 5/3/24.
//
import Foundation
enum IntentsError: Error {
case couldNotFetchNotes
case couldNotFetchTags
var title: String {
switch self {
case .couldNotFetchNotes:
return NSLocalizedStr... | /content/code_sandbox/SimplenoteIntents/IntentsError.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 201 |
```swift
//
// IntentsConstants.swift
// Simplenote
//
// Created by Charlie Scheer on 5/2/24.
//
import Foundation
struct IntentsConstants {
static let noteIdentifierKey = "OpenNoteIntentHandlerIdentifierKey"
static let recoveryMessage = NSLocalizedString("Will attempt to recover shortcut content on next... | /content/code_sandbox/SimplenoteIntents/IntentsConstants.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 92 |
```swift
import Intents
import CoreData
class IntentHandler: INExtension {
override func handler(for intent: INIntent) -> Any {
switch intent {
case is NoteWidgetIntent:
return NoteWidgetIntentHandler()
case is ListWidgetIntent:
return ListWidgetIntentHandler()
... | /content/code_sandbox/SimplenoteIntents/IntentHandler.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 178 |
```swift
//
// FindNoteIntentHandler.swift
// SimplenoteIntents
//
// Created by Charlie Scheer on 5/9/24.
//
import Intents
class FindNoteIntentHandler: NSObject, FindNoteIntentHandling {
let coreDataWrapper = ExtensionCoreDataWrapper()
func resolveNote(for intent: FindNoteIntent) async -> IntentNoteReso... | /content/code_sandbox/SimplenoteIntents/Intent Handlers/FindNoteIntentHandler.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 290 |
```swift
//
// NoteWidgetIntentHandler.swift
// Simplenote
//
// Created by Charlie Scheer on 5/2/24.
//
import Intents
class NoteWidgetIntentHandler: NSObject, NoteWidgetIntentHandling {
let coreDataWrapper = ExtensionCoreDataWrapper()
func provideNoteOptionsCollection(for intent: NoteWidgetIntent, with ... | /content/code_sandbox/SimplenoteIntents/Intent Handlers/NoteWidgetIntentHandler.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 295 |
```swift
import Intents
class CreateNewNoteIntentHandler: NSObject, CreateNewNoteIntentHandling {
let coreDataWrapper = ExtensionCoreDataWrapper()
func handle(intent: CreateNewNoteIntent) async -> CreateNewNoteIntentResponse {
guard let content = intent.content,
let token = KeychainManag... | /content/code_sandbox/SimplenoteIntents/Intent Handlers/CreateNewNoteIntentHandler.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 223 |
```swift
import Intents
class AppendNoteIntentHandler: NSObject, AppendNoteIntentHandling {
let coreDataWrapper = ExtensionCoreDataWrapper()
func resolveContent(for intent: AppendNoteIntent) async -> INStringResolutionResult {
guard let content = intent.content else {
return INStringResolu... | /content/code_sandbox/SimplenoteIntents/Intent Handlers/AppendNoteIntentHandler.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 479 |
```swift
//
// ListWidgetIntentHandler.swift
// Simplenote
//
// Created by Charlie Scheer on 5/2/24.
//
import Intents
class ListWidgetIntentHandler: NSObject, ListWidgetIntentHandling {
let coreDataWrapper = ExtensionCoreDataWrapper()
func provideTagOptionsCollection(for intent: ListWidgetIntent, with c... | /content/code_sandbox/SimplenoteIntents/Intent Handlers/ListWidgetIntentHandler.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 286 |
```swift
//
// OpenNoteIntentHandler.swift
// Simplenote
//
// Created by Charlie Scheer on 5/2/24.
//
import Intents
class OpenNoteIntentHandler: NSObject, OpenNoteIntentHandling {
let coreDataWrapper = ExtensionCoreDataWrapper()
func resolveNote(for intent: OpenNoteIntent) async -> IntentNoteResolutionR... | /content/code_sandbox/SimplenoteIntents/Intent Handlers/OpenNoteIntentHandler.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 245 |
```swift
//
// CopyNoteContentIntentHandler.swift
// SimplenoteIntents
//
// Created by Charlie Scheer on 5/9/24.
//
import Intents
class CopyNoteContentIntentHandler: NSObject, CopyNoteContentIntentHandling {
let coreDataWrapper = ExtensionCoreDataWrapper()
func provideNoteOptionsCollection(for intent: C... | /content/code_sandbox/SimplenoteIntents/Intent Handlers/CopyNoteContentIntentHandler.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 248 |
```swift
//
// OpenNewNoteIntentHandler.swift
// Simplenote
//
// Created by Charlie Scheer on 5/2/24.
//
import Intents
class OpenNewNoteIntentHandler: NSObject, OpenNewNoteIntentHandling {
func handle(intent: OpenNewNoteIntent) async -> OpenNewNoteIntentResponse {
OpenNewNoteIntentResponse(code: .con... | /content/code_sandbox/SimplenoteIntents/Intent Handlers/OpenNewNoteIntentHandler.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 92 |
```swift
//
// FindNoteWithTagIntentHandler.swift
// SimplenoteIntents
//
// Created by Charlie Scheer on 5/9/24.
//
import Intents
class FindNoteWithTagIntentHandler: NSObject, FindNoteWithTagIntentHandling {
let coreDataWrapper = ExtensionCoreDataWrapper()
func resolveNote(for intent: FindNoteWithTagInt... | /content/code_sandbox/SimplenoteIntents/Intent Handlers/FindNoteWithTagIntentHandler.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 282 |
```swift
//
// IntentNote+Helpers.swift
// SimplenoteIntents
//
// Created by Charlie Scheer on 5/8/24.
//
import Intents
extension IntentNoteResolutionResult {
static func resolve(_ intentNote: IntentNote?, in coreDataWrapper: ExtensionCoreDataWrapper) -> IntentNoteResolutionResult {
guard let intentN... | /content/code_sandbox/SimplenoteIntents/ResolutionResults/IntentNote+Helpers.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 529 |
```swift
//
// IntentTag+Helpers.swift
// SimplenoteIntents
//
// Created by Charlie Scheer on 5/9/24.
//
import Intents
extension IntentTag {
static func allTags(in coreDataWrapper: ExtensionCoreDataWrapper) throws -> [IntentTag] {
guard let tags = coreDataWrapper.resultsController()?.tags() else {
... | /content/code_sandbox/SimplenoteIntents/ResolutionResults/IntentTag+Helpers.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 121 |
```swift
import Foundation
import UniformTypeIdentifiers
public class RecoveryArchiver {
private let fileManager: FileManager
public init(fileManager: FileManager = .default) {
self.fileManager = fileManager
}
// MARK: Archive
//
public func archiveContent(_ content: String) {
... | /content/code_sandbox/SimplenoteIntents/Tools/RecoveryArchiver.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 220 |
```swift
import Foundation
struct Notice {
let message: String
let action: NoticeAction?
var hasAction: Bool {
return action != nil
}
}
extension Notice: Equatable {
static func == (lhs: Notice, rhs: Notice) -> Bool {
return lhs.message == rhs.message
}
}
``` | /content/code_sandbox/Simplenote/Notice.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 69 |
```swift
import UIKit
// MARK: - UISlider + Simplenote
//
extension UISlider {
/// Rect for thumb
///
var thumbRect: CGRect {
return thumbRect(forBounds: bounds,
trackRect: trackRect(forBounds: bounds),
value: value)
}
}
``` | /content/code_sandbox/Simplenote/UISlider+Simplenote.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 63 |
```swift
import Foundation
import Simperium
// MARK: - SPManagedObject extension
//
extension SPManagedObject {
/// Version as an Int
///
@objc
var versionInt: Int {
guard let versionStr = version(), let version = Int(versionStr) else {
return 1
}
return version
... | /content/code_sandbox/Simplenote/SPManagedObject+Version.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 73 |
```swift
//
// StoreProduct.swift
// Simplenote
//
// Created by Jorge Leandro Perez on 10/26/22.
//
import Foundation
// MARK: - StoreProduct
//
enum StoreProduct: String, CaseIterable {
case sustainerMonthly
case sustainerYearly
var identifier: String {
switch self {
case .sustainerY... | /content/code_sandbox/Simplenote/StoreProduct.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 196 |
```swift
import Foundation
extension URLComponents {
static func simplenoteURLComponents(with host: String? = nil) -> URLComponents? {
var components = URLComponents(string: .simplenotePath())
components?.host = host
return components
}
}
``` | /content/code_sandbox/Simplenote/URLComponents.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 58 |
```swift
import Foundation
extension Date {
func increased(byHours hours: Int) -> Date? {
var components = DateComponents()
components.hour = hours
return Calendar.current.date(byAdding: components, to: self)
}
func increased(byDays days: Int) -> Date? {
var components = Da... | /content/code_sandbox/Simplenote/Date+Simplenote.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 92 |
```swift
import Foundation
import SimplenoteFoundation
// MARK: - TagListViewController
//
final class TagListViewController: UIViewController {
@IBOutlet private weak var tableView: UITableView!
@IBOutlet private weak var rightBorderView: UIView!
@IBOutlet private weak var rightBorderWidthConstraint: NSLa... | /content/code_sandbox/Simplenote/TagListViewController.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 6,017 |
```swift
import Foundation
// MARK: - SPPinLockManager
//
class SPPinLockManager: NSObject {
@objc
static let shared = SPPinLockManager()
private let biometricAuthentication: BiometricAuthentication
init(biometricAuthentication: BiometricAuthentication = BiometricAuthentication()) {
self.bio... | /content/code_sandbox/Simplenote/SPPinLockManager.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 734 |
```swift
import Foundation
// MARK: - NoteMetrics
//
struct NoteMetrics {
/// Returns the total number of characters
///
let numberOfChars: Int
/// Returns the total number of words
///
let numberOfWords: Int
/// Creation Date
///
let creationDate: Date
/// Modification Date... | /content/code_sandbox/Simplenote/NoteMetrics.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 157 |
```swift
import UIKit
class SpinnerViewController: UIViewController {
private var alertView = UIView()
private var activityIndicator = UIActivityIndicatorView()
init() {
super.init(nibName: nil, bundle: nil)
setupView()
}
required init?(coder: NSCoder) {
super.init(coder: ... | /content/code_sandbox/Simplenote/SpinnerViewController.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 428 |
```swift
import Foundation
import SimplenoteEndpoints
import Simperium
// MARK: - Simperium's SPUser Conformance
//
extension SPUser: UserProtocol { }
``` | /content/code_sandbox/Simplenote/SPUser+UserProtocol.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 37 |
```swift
import Foundation
// MARK: - NoteScrollPositionCache: cache scroll offset
//
final class NoteScrollPositionCache {
typealias ScrollCache = [String: CGFloat]
private var cache: ScrollCache {
didSet {
try? storage.save(object: cache)
}
}
private let storage: FileSto... | /content/code_sandbox/Simplenote/NoteScrollPositionCache.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 198 |
```swift
import UIKit
// MARK: - SPCardDismissalReason: reason why card view controller was dismissed
//
enum SPCardDismissalReason {
/// Swipe down
///
case swipe
/// Tap outside of the card
///
case outsideTap
}
// MARK: - SPCardPresentationControllerDelegate
//
protocol SPCardPresentationC... | /content/code_sandbox/Simplenote/SPCardPresentationController.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 1,837 |
```objective-c
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "Preferences.h"
#import "Simplenote-Swift.h"
@implementation Preferences
@dynamic ghostData;
@dynamic simperiumKey;
@dynamic recent_searches;
@dynamic analytics_enabled;
@dynamic subscription_date;
@dynamic subscription_level;
@... | /content/code_sandbox/Simplenote/Preferences.m | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 185 |
```swift
import Foundation
extension NSTextStorage {
@objc(applyBackgroundColor:toRanges:)
func applyBackgroundColor(_ color: UIColor?, toRanges wordRanges: [NSValue]?) {
guard let color = color, let wordRanges = wordRanges else {
return
}
beginEditing()
let maxLen... | /content/code_sandbox/Simplenote/NSTextStorage+Simplenote.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 127 |
```swift
import Foundation
open class SeparatorsView: UIView {
// MARK: - Public Properties
open var leftVisible = false {
didSet {
setNeedsDisplay()
}
}
open var leftColor = UIColor.simplenoteDividerColor {
didSet {
setNeedsDisplay()
}
}
... | /content/code_sandbox/Simplenote/SeparatorsView.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 702 |
```swift
import Foundation
// MARK: - Wraps access to all of the UserDefault Values
//
class Options: NSObject {
/// Shared Instance
///
@objc
static let shared = Options()
/// User Defaults: Convenience
///
private let defaults: UserDefaults
/// Designated Initializer
///
//... | /content/code_sandbox/Simplenote/Options.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 1,103 |
```swift
import Foundation
// MARK: - AuthenticationValidator
//
struct AuthenticationValidator {
/// Minimum Password Length: Login
///
private let legacyPasswordLength = UInt(4)
/// Minimum Password Length: SignUp
///
private let strongPasswordLength = UInt(8)
/// Login Code Lengt... | /content/code_sandbox/Simplenote/AuthenticationValidator.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 669 |
```swift
import UIKit
// MARK: - SPCardView wraps content view in a view with rounded corners and a shadow
//
final class SPCardView: UIView {
private let containerView = UIView()
override init(frame: CGRect) {
super.init(frame: frame)
configure()
}
required init?(coder: NSCoder) {
... | /content/code_sandbox/Simplenote/SPCardView.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 426 |
```swift
import Foundation
struct NoticeFactory {
static func linkCopied() -> Notice {
Notice(message: Messages.linkCopied, action: nil)
}
static func publishing() -> Notice {
Notice(message: Messages.publishing, action: nil)
}
static func unpublishing() -> Notice {
Notice... | /content/code_sandbox/Simplenote/NoticeFactory.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 598 |
```swift
import UIKit
// MARK: - TagListViewCellDeletionSource - source from where the tag is deleted
//
enum TagListViewCellDeletionSource {
case menu
case accessory
}
// MARK: - TagListViewCellDelegate
//
protocol TagListViewCellDelegate: AnyObject {
func tagListViewCellShouldDeleteTag(_ cell: TagListVi... | /content/code_sandbox/Simplenote/TagListViewCell.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 757 |
```swift
import UIKit
protocol NoticeInteractionDelegate: AnyObject {
func noticePressBegan()
func noticePressEnded()
func actionWasTapped()
}
class NoticeView: UIView {
// MARK: Properties
//
@IBOutlet private weak var backgroundView: UIView!
@IBOutlet private weak var stackView: UIStack... | /content/code_sandbox/Simplenote/NoticeView.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 662 |
```swift
import Foundation
// MARK: - SPEditorTextView
//
extension SPEditorTextView {
/// Text with attachments converted to markdown
@objc
var plainText: String {
return NSAttributedStringToMarkdownConverter.convert(string: attributedText)
}
/// Selected text with attachments converted ... | /content/code_sandbox/Simplenote/SPEditorTextView+Simplenote.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 264 |
```swift
import Foundation
struct NoticeAction {
let title: String
let handler: () -> Void
}
``` | /content/code_sandbox/Simplenote/NoticeAction.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 23 |
```swift
import UIKit
// MARK: - SPCardTransitioningManager: Manages card-like presentation of a view controller
//
final class SPCardTransitioningManager: NSObject, UIViewControllerTransitioningDelegate {
private weak var presentationController: SPCardPresentationController?
/// Delegate for presentation (an... | /content/code_sandbox/Simplenote/SPCardTransitioningManager.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 256 |
```swift
import Foundation
// MARK: - EmailVerification
//
struct EmailVerification {
let token: EmailVerificationToken?
let sentTo: String?
}
// MARK: - EmailVerificationToken
//
struct EmailVerificationToken: Decodable {
let username: String
}
// MARK: - Init from payload
//
extension EmailVerification... | /content/code_sandbox/Simplenote/EmailVerification.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 208 |
```swift
//
// StoreConstants.swift
// Simplenote
//
// Created by Jorge Leandro Perez on 10/27/22.
//
import Foundation
// MARK: - Settings
//
enum StoreConstants {
static let platform = "iOS"
static let activeSubscriptionLevel = "sustainer"
}
``` | /content/code_sandbox/Simplenote/StoreConstants.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 67 |
```swift
import Foundation
enum WidgetError: Error {
case appConfigurationError
case fetchError
}
extension WidgetError {
/// Returns the Error Title, for Alert purposes
///
var title: String {
switch self {
case .appConfigurationError:
return NSLocalizedString("Main Ap... | /content/code_sandbox/Simplenote/WidgetError.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 194 |
```swift
import UIKit
// MARK: - TableHeaderViewCell
//
final class TableHeaderViewCell: UITableViewCell {
private let titleLabel = UILabel()
/// Wraps the TitleLabel's Text Property
///
var title: String? {
get {
titleLabel.text
}
set {
titleLabel.text ... | /content/code_sandbox/Simplenote/TableHeaderViewCell.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 295 |
```swift
import Foundation
import SimplenoteSearch
extension SearchQuery {
convenience init(searchText: String) {
self.init(searchText: searchText, settings: .default)
}
}
extension SearchQuerySettings {
static var `default`: SearchQuerySettings {
let localizedKeyword = NSLocalizedString("... | /content/code_sandbox/Simplenote/SearchQuery+Simplenote.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 101 |
```swift
import Foundation
extension Note {
var publishState: PublishState {
if published && !publishURL.isEmpty {
return .published
}
if published && publishURL.isEmpty {
return .publishing
}
if !published && !publishURL.isEmpty {
retur... | /content/code_sandbox/Simplenote/Note+Publish.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 98 |
```swift
import Foundation
import UIKit
// MARK: - BannerView
//
class BannerView: UIView {
@IBOutlet
private var backgroundView: UIView!
@IBOutlet
private var titleLabel: UILabel!
@IBOutlet
private var detailsLabel: UILabel!
@IBOutlet
private var topConstraint: NSLayoutConstraint!
... | /content/code_sandbox/Simplenote/BannerView.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 549 |
```swift
import Foundation
import AutomatticTracks
/// This exists to bridge CrashLogging with Objective-C. Once the App Delegate is moved over to Swift,
/// this shim can be removed, and the cache methods moved to a `CrashLogging` extension. At that time,
/// you, future developer, can just set up the Crash Logging s... | /content/code_sandbox/Simplenote/CrashLogging.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 936 |
```swift
import UIKit
class NoticePresenter {
// MARK: Properties
//
private var noticeView: UIView?
private var containerView: PassthruView?
private var noticeVariableConstraint: NSLayoutConstraint?
private var keyboardHeight: CGFloat = .zero
private var keyboardFloats: Bool = false
... | /content/code_sandbox/Simplenote/NoticePresenter.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 1,075 |
```swift
import Foundation
import UniformTypeIdentifiers
import CoreData
public class RecoveryUnarchiver {
private let fileManager: FileManager
private let simperium: Simperium
public init(fileManager: FileManager = .default, simperium: Simperium) {
self.fileManager = fileManager
self.simp... | /content/code_sandbox/Simplenote/RecoveryUnarchiver.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 343 |
```objective-c
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSMutableAttributedString (Checklists)
/// Replaces Checklist Markers with a SPTextAttachment at the exact same location.
///
/// @param color: Tinting Color to be applied over the Image
/// @param sizingFont: Font that should be use... | /content/code_sandbox/Simplenote/NSMutableAttributedString+Styling.h | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 268 |
```objective-c
#import <Simperium/SPManagedObject.h>
@interface Preferences: SPManagedObject
@property (nullable, nonatomic, strong) NSArray<NSString *> *recent_searches;
@property (nullable, nonatomic, copy) NSNumber *analytics_enabled;
@property (nullable, nonatomic, copy) NSDate *subs... | /content/code_sandbox/Simplenote/Preferences.h | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 113 |
```swift
//
// StoreManager.swift
// Simplenote
//
// Created by Jorge Leandro Perez on 10/26/22.
//
import Foundation
import StoreKit
// MARK: - StoreError
//
enum StoreError: Error {
case failedVerification
}
// MARK: - StoreManager
//
class StoreManager {
// MARK: - Static
//
static let shared... | /content/code_sandbox/Simplenote/StoreManager.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 1,699 |
```swift
import Foundation
// MARK: - NumberFormatter Extension
//
extension NumberFormatter {
/// Number formatter with decimal style
///
static let decimalFormatter: NumberFormatter = {
let formatter = NumberFormatter()
formatter.numberStyle = .decimal
return formatter
}()
}
... | /content/code_sandbox/Simplenote/NumberFormatter+Simplenote.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 59 |
```objective-c
//
// SPConstants.h
// Simplenote
//
// Created by Jorge Leandro Perez on 12/22/14.
//
#import <Foundation/Foundation.h>
#pragma mark ================================================================================
#pragma mark Constants
#pragma mark ===============================================... | /content/code_sandbox/Simplenote/SPConstants.h | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 212 |
```swift
import Foundation
import CoreData
enum CoreDataUsageType {
case standard
case intents
case widgets
}
@objcMembers
class CoreDataManager: NSObject {
// MARK: Core Data
private(set) var managedObjectModel: NSManagedObjectModel!
private(set) var managedObjectContext: NSManagedObjectCont... | /content/code_sandbox/Simplenote/CoreDataManager.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 456 |
```objective-c
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#pragma mark - External
#import <Simperium/Simperium.h>
#pragma mark - Simplenote-Y
#import "Note.h"
#import "Tag.h"
#import "Settings.h"
#import "PersonTag.h"
#import "SPAppDelegate.h"
#import "S... | /content/code_sandbox/Simplenote/Simplenote-Bridging-Header.h | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 258 |
```swift
import UIKit
// MARK: - PinLockProgressView
//
final class PinLockProgressView: UIStackView {
/// Length of the progress view
///
var length: Int = 0 {
didSet {
configure()
}
}
/// Progress is from 0 to `length`
///
var progress: Int = 0 {
didS... | /content/code_sandbox/Simplenote/PinLockProgressView.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 392 |
```swift
/// Simplenote API Credentials
///
@objcMembers
class SPCredentials: NSObject {
/// AppBot
///
static let appbotKey = "not-required"
/// AppCenter
///
static let appCenterIdentifier = "not-required"
/// Google Analytics
///
static let googleAnalyticsID = "not-required"
... | /content/code_sandbox/Simplenote/SPCredentials-demo.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 339 |
```swift
import UIKit
// MARK: - SPSnappingSlider - Slider that snaps to certain values
//
@IBDesignable
final class SPSnappingSlider: UISlider {
/// Step for snapping
///
@IBInspectable
var step: Float = 1.0 {
didSet {
setValue(value, animated: false)
}
}
/// Call... | /content/code_sandbox/Simplenote/SPSnappingSlider.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 381 |
```swift
import Foundation
extension URL {
static func internalUrl(forTag tag: String?) -> URL {
guard var components = URLComponents.simplenoteURLComponents(with: SimplenoteConstants.simplenoteInternalTagHost),
let tag = tag else {
return URL(string: .simplenotePath(withHost: Sim... | /content/code_sandbox/Simplenote/URL+Simplenote.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 302 |
```swift
import UIKit
class SPDragBar: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
configure()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
configure()
}
private func configure() {
let color = UIColor(lightColor: ColorStu... | /content/code_sandbox/Simplenote/SPDragBar.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 115 |
```swift
import UIKit
// MARK: - PopoverPresenter
//
final class PopoverPresenter {
private var popoverController: PopoverViewController?
private let containerViewController: UIViewController
private let siblingView: UIView?
private let viewportProvider: () -> CGRect
private var desiredHeight: C... | /content/code_sandbox/Simplenote/PopoverPresenter.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 1,362 |
```objective-c
#import "NSMutableAttributedString+Styling.h"
#import "NSString+Bullets.h"
#import "Simplenote-Swift.h"
@implementation NSMutableAttributedString (Checklists)
- (void)processChecklistsWithColor:(UIColor *)color
sizingFont:(UIFont *)sizingFont
allowsMultiplePerLine... | /content/code_sandbox/Simplenote/NSMutableAttributedString+Styling.m | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 451 |
```objective-c
#import "SPAppDelegate.h"
#import "Simplenote-Swift.h"
#import "SPConstants.h"
#import "SPNavigationController.h"
#import "SPNoteListViewController.h"
#import "SPNoteEditorViewController.h"
#import "SPSettingsViewController.h"
#import "SPAddCollaboratorsViewController.h"
#import "NSManagedObjectContex... | /content/code_sandbox/Simplenote/SPAppDelegate.m | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 3,567 |
```swift
import Foundation
extension UIButton {
func setTitleWithoutAnimation(_ title: String?, for state: UIControl.State) {
UIView.performWithoutAnimation {
self.setTitle(title, for: state)
self.layoutIfNeeded()
}
}
func setAttributedTitleWithoutAnimatio... | /content/code_sandbox/Simplenote/UIButton+Simplenote.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 98 |
```swift
import Foundation
// MARK: - Note + Links
//
extension Note {
/// Internal note link
///
var plainInternalLink: String? {
guard let key = simperiumKey else {
return nil
}
return .simplenotePath(withHost: SimplenoteConstants.simplenoteInterlinkHost) + key
}... | /content/code_sandbox/Simplenote/Note+Links.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 283 |
```objective-c
//
// SPConstants.m
// Simplenote
//
// Created by Jorge Leandro Perez on 12/22/14.
//
#import "SPConstants.h"
#pragma mark ================================================================================
#pragma mark Constants
#pragma mark =========================================================... | /content/code_sandbox/Simplenote/SPConstants.m | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 346 |
```swift
import UIKit
// MARK: - SubtitleTableViewCell
//
final class SubtitleTableViewCell: UITableViewCell {
/// Wraps the TextLabel's Text Property
///
var title: String? {
get {
textLabel?.text
}
set {
textLabel?.text = newValue
}
}
/// ... | /content/code_sandbox/Simplenote/SubtitleTableViewCell.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 370 |
```swift
import UIKit
// MARK: - SPTextAttachment
//
@objcMembers
class SPTextAttachment: NSTextAttachment {
/// Extra Sizing Points to be appled over the actual Sizing Font Size
///
var extraDimensionPoints: CGFloat = 4
/// Indicates if we're in the Checked or Unchecked state
///
var isCheck... | /content/code_sandbox/Simplenote/SPTextAttachment.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 323 |
```swift
import Foundation
// MARK: - SPNoteHistoryControllerDelegate
//
protocol SPNoteHistoryControllerDelegate: AnyObject {
/// Cancel
///
func noteHistoryControllerDidCancel()
/// Finish and save
///
func noteHistoryControllerDidFinish()
/// Preview version content
///
func n... | /content/code_sandbox/Simplenote/SPNoteHistoryControllerDelegate.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 77 |
```swift
import Foundation
// MARK: - UIAlertController Helpers
//
extension UIAlertController {
/// Builds an alert indicating that the Login Code has Expired
///
static func buildLoginCodeNotFoundAlert(onRequestCode: @escaping () -> Void) -> UIAlertController {
let title = NSLocalizedString... | /content/code_sandbox/Simplenote/UIAlertController+Auth.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 157 |
```swift
import SwiftUI
extension Color {
/// Convenience initializers to get and use Simplenote color studio colors
///
init(studioColor: ColorStudio, alpha: CGFloat = UIKitConstants.alpha1_0) {
self.init(UIColor(studioColor: studioColor, alpha: alpha))
}
init(for colorScheme: ColorScheme... | /content/code_sandbox/Simplenote/Color+Simplenote.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 224 |
```swift
import Foundation
// MARK: - SPCardConfigurable: configure card
//
protocol SPCardConfigurable {
/// This method allows the adopter to control swipe-to-dismiss
///
/// - Parameters:
/// - location: location in receiver's coordinate system.
///
/// - Returns: Boolean value indicatin... | /content/code_sandbox/Simplenote/SPCardConfigurable.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 92 |
```swift
import UIKit
extension UIView {
struct EdgeConstraints {
let leading: NSLayoutConstraint
let trailing: NSLayoutConstraint
let top: NSLayoutConstraint
let bottom: NSLayoutConstraint
func update(with edgeInsets: UIEdgeInsets) {
leading.constant = edgeInse... | /content/code_sandbox/Simplenote/UIView+Constraints.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 434 |
```swift
import UIKit
// MARK: - Card presentation animator
//
final class SPCardPresentationAnimator: NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return UIKitConstants.animationShortDuration
... | /content/code_sandbox/Simplenote/SPCardPresentationAnimator.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 213 |
```swift
import UIKit
// MARK: - HuggableTableView
// Table View that wraps it's own content (tries to set it's own height to match the content)
//
class HuggableTableView: UITableView {
lazy var maxHeightConstraint: NSLayoutConstraint = {
let constraint = heightAnchor.constraint(lessThanOrEqualToConstant... | /content/code_sandbox/Simplenote/HuggableTableView.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 500 |
```swift
import Foundation
// MARK: - NSPredicate Validation Methods
//
extension NSPredicate {
/// Returns a NSPredicate capable of validating Email Addressess
///
static func predicateForEmailValidation() -> NSPredicate {
let regex = ".+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2}[A-Za-z]*"
return NS... | /content/code_sandbox/Simplenote/NSPredicate+Email.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 91 |
```swift
import Foundation
// MARK: - State
//
struct AuthenticationState {
var username = String()
var password = String()
var code = String()
}
// MARK: - Authentication Elements
//
struct AuthenticationInputElements: OptionSet, Hashable {
let rawValue: UInt
static let username = ... | /content/code_sandbox/Simplenote/AuthenticationMode.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 1,340 |
```swift
import Foundation
class TimerFactory {
func scheduledTimer(with timeInterval: TimeInterval, completion: @escaping () -> Void) -> Timer {
return Timer.scheduledTimer(withTimeInterval: timeInterval, repeats: false) { (_) in
completion()
}
}
func repeatingTimer(with timer... | /content/code_sandbox/Simplenote/TimerFactory.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 109 |
```objective-c
#import <UIKit/UIKit.h>
#import <Simperium/Simperium.h>
@class SPSidebarContainerViewController;
@class TagListViewController;
@class SPNoteListViewController;
@class SPNoteEditorViewController;
@class SPNavigationController;
@class VersionsController;
@class AccountVerificationController;
@class Accou... | /content/code_sandbox/Simplenote/SPAppDelegate.h | objective-c | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 362 |
```swift
import UIKit
// MARK: - Search map view
//
@objc
final class SearchMapView: UIView {
/// Callback to be invoked on selection change
///
var onSelectionChange: ((Int) -> Void)?
private var barViews: [UIView] = []
private lazy var feedbackGenerator = UISelectionFeedbackGenerator()
pr... | /content/code_sandbox/Simplenote/SearchMapView.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 848 |
```swift
import Foundation
import SwiftUI
import Gridicons
// MARK: - MagicLinkRequestedView
//
struct MagicLinkRequestedView: View {
@Environment(\.presentationMode) var presentationMode
@State private var displaysFullImage: Bool = false
let email: String
var body: some View {
Navigatio... | /content/code_sandbox/Simplenote/MagicLinkRequestedView.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 535 |
```swift
//
// Preferences+IAP.swift
// Simplenote
//
// Created by Jorge Leandro Perez on 10/27/22.
//
import Foundation
// MARK: - Preferences Extensions
//
extension Preferences {
@objc
var isActiveSubscriber: Bool {
subscription_level == StoreConstants.activeSubscriptionLevel
}
@objc
... | /content/code_sandbox/Simplenote/Preferences+IAP.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 95 |
```swift
import UIKit
class NoticeController {
// MARK: Proerties
//
static let shared = NoticeController()
private var current: Notice?
private let noticePresenter: NoticePresenter
private let timerFactory: TimerFactory
private var timer: Timer? {
didSet {
oldValue?.i... | /content/code_sandbox/Simplenote/NoticeController.swift | swift | 2016-08-11T15:55:22 | 2024-08-14T02:42:22 | simplenote-ios | Automattic/simplenote-ios | 2,038 | 507 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.