Skip to content

Instantly share code, notes, and snippets.

View kostapappas's full-sized avatar

LAMPROS KOSTAPAPPAS kostapappas

View GitHub Profile
@kostapappas
kostapappas / customView.swift
Last active November 20, 2021 05:16
Swift 4, custom UIView with explanations
class MyCustomView: UIView {
private var didSetupConstraints = false
//In Swift initializers are not inherited for subclasses by default
override init(frame: CGRect) {
super.init(frame: frame)
}
// Deserialize your object here
@kostapappas
kostapappas / customUITableViewCell.swift
Last active November 5, 2018 17:58
custom UITableViewCell
final class MyCell: UITableViewCell {
final let myCustomView: UIView
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
self.myCustomView = UIView()
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.contentView.addSubview(self.myCustomView)
self.initializeBasicElements()
}
@kostapappas
kostapappas / Localization techniques.swift
Last active October 2, 2018 12:25
Localization techniques
https://medium.com/@marcosantadev/app-localization-tips-with-swift-4e9b2d9672c9
1. Add localization language on Project
2. Add a string File "Localizable" (or many string files for better organization ex: "SpecificCategoryTableName" )
3. add following code
extension String {
func localized(bundle: Bundle = .main, tableName: String = "Localizable") -> String {
return NSLocalizedString(self, tableName: tableName, value: "**\(self)**", comment: "")
}
}
@kostapappas
kostapappas / scheme improvements.swift
Last active October 2, 2018 13:06
scheme improvements.swift
Enviromental Arguments
- DYLD_PRINT_STATISTICS = true( shows Slow App Startup Times)
- OS_ACTIVITY_MODE = disable (turn off default OS logging)
@kostapappas
kostapappas / Apple rejections reasons
Created December 12, 2018 08:36
Apple rejections reasons
Personal rejections
MetaData
- Iphone X picture in iphone 5 slots
User Data
- Get personal user data without explain where are you going to use them
-
@kostapappas
kostapappas / uibutton indexpath row section
Created December 15, 2018 08:56
add row, sector, indexpath in button
extension UIButton {
private struct AssociatedKeys {
static var section = "section"
static var row = "row"
}
var section: Int {
get {
guard let number = objc_getAssociatedObject(self, &AssociatedKeys.section) as? Int else {
@kostapappas
kostapappas / pushNotifiations.js
Last active May 9, 2020 11:44
Firebase javascript function to send push notification when a new item added in firestore
const functions = require('firebase-functions');
const admin = require("firebase-admin");
admin.initializeApp();
exports.notifyNewMessage = functions.firestore
.document('365BetaCannels2/{chanl}/thrad/{messe}')
.onCreate((docSnapshot, context) => {
const message = docSnapshot.data();
const recipientId = message['recipientID'];
@kostapappas
kostapappas / CIFilter+Extension.swift
Created May 28, 2019 15:19 — forked from Umity/CIFilter+Extension.swift
CIFilter+Extension.swift
//
// Created by はるふ on 2017/12/11.
// Copyright © 2017年 ha1f. All rights reserved.
//
import Foundation
import CoreImage
import AVFoundation
extension CIFilter {
@kostapappas
kostapappas / filter.swift
Created May 28, 2019 15:20 — forked from seivan/filter.swift
Sample CIFilter with Swift.
@objc class JPTiltShiftGenerator: NSObject, CIFilterConstructor {
@objc func filterWithName(name: String)->CIFilter? {
return JPTiltShift()
}
}
class JPTiltShift : CIFilter {
class func register() {
@kostapappas
kostapappas / CIFilter+Extension.swift
Created May 28, 2019 15:20 — forked from ha1f/CIFilter+Extension.swift
CIFilter+Extension.swift
//
// Created by はるふ on 2017/12/11.
// Copyright © 2017年 ha1f. All rights reserved.
//
import Foundation
import CoreImage
import AVFoundation
extension CIFilter {